<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html><head><title>QPainter Class Reference</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
td.postheader { font-family: sans-serif }
tr.address { font-family: sans-serif }
body { background: #ffffff; color: black; }
</style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr /><td align="left" valign="top" width="32"><img align="left" border="0" height="32" src="images/rb-logo.png" width="32" /></td><td width="1">&#160;&#160;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&#160;&#183; <a href="classes.html"><font color="#004faf">All Classes</font></a>&#160;&#183; <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QPainter Class Reference<br /><sup><sup>[<a href="qtgui.html">QtGui</a> module]</sup></sup></h1><p>The QPainter class performs low-level painting on widgets and
other paint devices. <a href="#details">More...</a></p>

<p>Inherited by <a href="qstylepainter.html">QStylePainter</a>.</p><h3>Types</h3><ul><li><div class="fn" />enum <b><a href="qpainter.html#CompositionMode-enum">CompositionMode</a></b> { CompositionMode_SourceOver, CompositionMode_DestinationOver, CompositionMode_Clear, CompositionMode_Source, ..., RasterOp_SourceAndNotDestination }</li><li><div class="fn" />class <b><a href="qpainter-pixmapfragment.html">PixmapFragment</a></b></li><li><div class="fn" />enum <b><a href="qpainter.html#PixmapFragmentHint-enum">PixmapFragmentHint</a></b> { OpaqueHint }</li><li><div class="fn" />class <b><a href="qpainter-pixmapfragmenthints.html">PixmapFragmentHints</a></b></li><li><div class="fn" />enum <b><a href="qpainter.html#RenderHint-enum">RenderHint</a></b> { Antialiasing, TextAntialiasing, SmoothPixmapTransform, HighQualityAntialiasing, NonCosmeticDefaultPen }</li><li><div class="fn" />class <b><a href="qpainter-renderhints.html">RenderHints</a></b></li></ul><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qpainter.html#QPainter">__init__</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qpainter.html#QPainter-2">__init__</a></b> (<i>self</i>, QPaintDevice)</li><li><div class="fn" />QBrush <b><a href="qpainter.html#background">background</a></b> (<i>self</i>)</li><li><div class="fn" />Qt.BGMode <b><a href="qpainter.html#backgroundMode">backgroundMode</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qpainter.html#begin">begin</a></b> (<i>self</i>, QPaintDevice)</li><li><div class="fn" /><b><a href="qpainter.html#beginNativePainting">beginNativePainting</a></b> (<i>self</i>)</li><li><div class="fn" />QRectF <b><a href="qpainter.html#boundingRect">boundingRect</a></b> (<i>self</i>, QRectF&#160;<i>rect</i>, int&#160;<i>flags</i>, QString&#160;<i>text</i>)</li><li><div class="fn" />QRect <b><a href="qpainter.html#boundingRect-2">boundingRect</a></b> (<i>self</i>, QRect&#160;<i>rect</i>, int&#160;<i>flags</i>, QString&#160;<i>text</i>)</li><li><div class="fn" />QRectF <b><a href="qpainter.html#boundingRect-3">boundingRect</a></b> (<i>self</i>, QRectF&#160;<i>rectangle</i>, QString&#160;<i>text</i>, QTextOption&#160;<i>option</i>&#160;=&#160;QTextOption())</li><li><div class="fn" />QRect <b><a href="qpainter.html#boundingRect-4">boundingRect</a></b> (<i>self</i>, int&#160;<i>x</i>, int&#160;<i>y</i>, int&#160;<i>w</i>, int&#160;<i>h</i>, int&#160;<i>flags</i>, QString&#160;<i>text</i>)</li><li><div class="fn" />QBrush <b><a href="qpainter.html#brush">brush</a></b> (<i>self</i>)</li><li><div class="fn" />QPoint <b><a href="qpainter.html#brushOrigin">brushOrigin</a></b> (<i>self</i>)</li><li><div class="fn" />QPainterPath <b><a href="qpainter.html#clipPath">clipPath</a></b> (<i>self</i>)</li><li><div class="fn" />QRegion <b><a href="qpainter.html#clipRegion">clipRegion</a></b> (<i>self</i>)</li><li><div class="fn" />QMatrix <b><a href="qpainter.html#combinedMatrix">combinedMatrix</a></b> (<i>self</i>)</li><li><div class="fn" />QTransform <b><a href="qpainter.html#combinedTransform">combinedTransform</a></b> (<i>self</i>)</li><li><div class="fn" />CompositionMode <b><a href="qpainter.html#compositionMode">compositionMode</a></b> (<i>self</i>)</li><li><div class="fn" />QPaintDevice <b><a href="qpainter.html#device">device</a></b> (<i>self</i>)</li><li><div class="fn" />QMatrix <b><a href="qpainter.html#deviceMatrix">deviceMatrix</a></b> (<i>self</i>)</li><li><div class="fn" />QTransform <b><a href="qpainter.html#deviceTransform">deviceTransform</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qpainter.html#drawArc">drawArc</a></b> (<i>self</i>, QRectF&#160;<i>rect</i>, int&#160;<i>a</i>, int&#160;<i>alen</i>)</li><li><div class="fn" /><b><a href="qpainter.html#drawArc-2">drawArc</a></b> (<i>self</i>, QRect&#160;<i>r</i>, int&#160;<i>a</i>, int&#160;<i>alen</i>)</li><li><div class="fn" /><b><a href="qpainter.html#drawArc-3">drawArc</a></b> (<i>self</i>, int&#160;<i>x</i>, int&#160;<i>y</i>, int&#160;<i>w</i>, int&#160;<i>h</i>, int&#160;<i>a</i>, int&#160;<i>alen</i>)</li><li><div class="fn" /><b><a href="qpainter.html#drawChord">drawChord</a></b> (<i>self</i>, QRectF&#160;<i>rect</i>, int&#160;<i>a</i>, int&#160;<i>alen</i>)</li><li><div class="fn" /><b><a href="qpainter.html#drawChord-2">drawChord</a></b> (<i>self</i>, QRect&#160;<i>rect</i>, int&#160;<i>a</i>, int&#160;<i>alen</i>)</li><li><div class="fn" /><b><a href="qpainter.html#drawChord-3">drawChord</a></b> (<i>self</i>, int&#160;<i>x</i>, int&#160;<i>y</i>, int&#160;<i>w</i>, int&#160;<i>h</i>, int&#160;<i>a</i>, int&#160;<i>alen</i>)</li><li><div class="fn" /><b><a href="qpainter.html#drawConvexPolygon">drawConvexPolygon</a></b> (<i>self</i>, QPointF&#160;<i>point</i>, ...)</li><li><div class="fn" /><b><a href="qpainter.html#drawConvexPolygon-2">drawConvexPolygon</a></b> (<i>self</i>, QPolygonF&#160;<i>poly</i>)</li><li><div class="fn" /><b><a href="qpainter.html#drawConvexPolygon-3">drawConvexPolygon</a></b> (<i>self</i>, QPoint&#160;<i>point</i>, ...)</li><li><div class="fn" /><b><a href="qpainter.html#drawConvexPolygon-4">drawConvexPolygon</a></b> (<i>self</i>, QPolygon&#160;<i>poly</i>)</li><li><div class="fn" /><b><a href="qpainter.html#drawEllipse">drawEllipse</a></b> (<i>self</i>, QRectF&#160;<i>r</i>)</li><li><div class="fn" /><b><a href="qpainter.html#drawEllipse-2">drawEllipse</a></b> (<i>self</i>, QRect&#160;<i>r</i>)</li><li><div class="fn" /><b><a href="qpainter.html#drawEllipse-3">drawEllipse</a></b> (<i>self</i>, int&#160;<i>x</i>, int&#160;<i>y</i>, int&#160;<i>w</i>, int&#160;<i>h</i>)</li><li><div class="fn" /><b><a href="qpainter.html#drawEllipse-4">drawEllipse</a></b> (<i>self</i>, QPointF&#160;<i>center</i>, float&#160;<i>rx</i>, float&#160;<i>ry</i>)</li><li><div class="fn" /><b><a href="qpainter.html#drawEllipse-5">drawEllipse</a></b> (<i>self</i>, QPoint&#160;<i>center</i>, int&#160;<i>rx</i>, int&#160;<i>ry</i>)</li><li><div class="fn" /><b><a href="qpainter.html#drawImage">drawImage</a></b> (<i>self</i>, QRectF&#160;<i>targetRect</i>, QImage&#160;<i>image</i>, QRectF&#160;<i>sourceRect</i>, Qt.ImageConversionFlags&#160;<i>flags</i>&#160;=&#160;Qt.AutoColor)</li><li><div class="fn" /><b><a href="qpainter.html#drawImage-2">drawImage</a></b> (<i>self</i>, QRect&#160;<i>targetRect</i>, QImage&#160;<i>image</i>, QRect&#160;<i>sourceRect</i>, Qt.ImageConversionFlags&#160;<i>flags</i>&#160;=&#160;Qt.AutoColor)</li><li><div class="fn" /><b><a href="qpainter.html#drawImage-3">drawImage</a></b> (<i>self</i>, QPointF&#160;<i>p</i>, QImage&#160;<i>image</i>, QRectF&#160;<i>sr</i>, Qt.ImageConversionFlags&#160;<i>flags</i>&#160;=&#160;Qt.AutoColor)</li><li><div class="fn" /><b><a href="qpainter.html#drawImage-4">drawImage</a></b> (<i>self</i>, QPoint&#160;<i>p</i>, QImage&#160;<i>image</i>, QRect&#160;<i>sr</i>, Qt.ImageConversionFlags&#160;<i>flags</i>&#160;=&#160;Qt.AutoColor)</li><li><div class="fn" /><b><a href="qpainter.html#drawImage-5">drawImage</a></b> (<i>self</i>, QRectF&#160;<i>r</i>, QImage&#160;<i>image</i>)</li><li><div class="fn" /><b><a href="qpainter.html#drawImage-6">drawImage</a></b> (<i>self</i>, QRect&#160;<i>r</i>, QImage&#160;<i>image</i>)</li><li><div class="fn" /><b><a href="qpainter.html#drawImage-7">drawImage</a></b> (<i>self</i>, QPointF&#160;<i>p</i>, QImage&#160;<i>image</i>)</li><li><div class="fn" /><b><a href="qpainter.html#drawImage-8">drawImage</a></b> (<i>self</i>, QPoint&#160;<i>p</i>, QImage&#160;<i>image</i>)</li><li><div class="fn" /><b><a href="qpainter.html#drawImage-9">drawImage</a></b> (<i>self</i>, int&#160;<i>x</i>, int&#160;<i>y</i>, QImage&#160;<i>image</i>, int&#160;<i>sx</i>&#160;=&#160;0, int&#160;<i>sy</i>&#160;=&#160;0, int&#160;<i>sw</i>&#160;=&#160;-1, int&#160;<i>sh</i>&#160;=&#160;-1, Qt.ImageConversionFlags&#160;<i>flags</i>&#160;=&#160;Qt.AutoColor)</li><li><div class="fn" /><b><a href="qpainter.html#drawLine">drawLine</a></b> (<i>self</i>, QLineF&#160;<i>l</i>)</li><li><div class="fn" /><b><a href="qpainter.html#drawLine-2">drawLine</a></b> (<i>self</i>, QLine&#160;<i>line</i>)</li><li><div class="fn" /><b><a href="qpainter.html#drawLine-3">drawLine</a></b> (<i>self</i>, int&#160;<i>x1</i>, int&#160;<i>y1</i>, int&#160;<i>x2</i>, int&#160;<i>y2</i>)</li><li><div class="fn" /><b><a href="qpainter.html#drawLine-4">drawLine</a></b> (<i>self</i>, QPoint&#160;<i>p1</i>, QPoint&#160;<i>p2</i>)</li><li><div class="fn" /><b><a href="qpainter.html#drawLine-5">drawLine</a></b> (<i>self</i>, QPointF&#160;<i>p1</i>, QPointF&#160;<i>p2</i>)</li><li><div class="fn" /><b><a href="qpainter.html#drawLines">drawLines</a></b> (<i>self</i>, QLineF&#160;<i>line</i>, ...)</li><li><div class="fn" /><b><a href="qpainter.html#drawLines-2">drawLines</a></b> (<i>self</i>, list-of-QLineF&#160;<i>lines</i>)</li><li><div class="fn" /><b><a href="qpainter.html#drawLines-3">drawLines</a></b> (<i>self</i>, QPointF&#160;<i>pointPair</i>, ...)</li><li><div class="fn" /><b><a href="qpainter.html#drawLines-4">drawLines</a></b> (<i>self</i>, list-of-QPointF&#160;<i>pointPairs</i>)</li><li><div class="fn" /><b><a href="qpainter.html#drawLines-5">drawLines</a></b> (<i>self</i>, QLine&#160;<i>line</i>, ...)</li><li><div class="fn" /><b><a href="qpainter.html#drawLines-6">drawLines</a></b> (<i>self</i>, list-of-QLine&#160;<i>lines</i>)</li><li><div class="fn" /><b><a href="qpainter.html#drawLines-7">drawLines</a></b> (<i>self</i>, QPoint&#160;<i>pointPair</i>, ...)</li><li><div class="fn" /><b><a href="qpainter.html#drawLines-8">drawLines</a></b> (<i>self</i>, list-of-QPoint&#160;<i>pointPairs</i>)</li><li><div class="fn" /><b><a href="qpainter.html#drawPath">drawPath</a></b> (<i>self</i>, QPainterPath&#160;<i>path</i>)</li><li><div class="fn" /><b><a href="qpainter.html#drawPicture">drawPicture</a></b> (<i>self</i>, QPointF&#160;<i>p</i>, QPicture&#160;<i>picture</i>)</li><li><div class="fn" /><b><a href="qpainter.html#drawPicture-2">drawPicture</a></b> (<i>self</i>, int&#160;<i>x</i>, int&#160;<i>y</i>, QPicture&#160;<i>p</i>)</li><li><div class="fn" /><b><a href="qpainter.html#drawPicture-3">drawPicture</a></b> (<i>self</i>, QPoint&#160;<i>pt</i>, QPicture&#160;<i>p</i>)</li><li><div class="fn" /><b><a href="qpainter.html#drawPie">drawPie</a></b> (<i>self</i>, QRectF&#160;<i>rect</i>, int&#160;<i>a</i>, int&#160;<i>alen</i>)</li><li><div class="fn" /><b><a href="qpainter.html#drawPie-2">drawPie</a></b> (<i>self</i>, QRect&#160;<i>rect</i>, int&#160;<i>a</i>, int&#160;<i>alen</i>)</li><li><div class="fn" /><b><a href="qpainter.html#drawPie-3">drawPie</a></b> (<i>self</i>, int&#160;<i>x</i>, int&#160;<i>y</i>, int&#160;<i>w</i>, int&#160;<i>h</i>, int&#160;<i>a</i>, int&#160;<i>alen</i>)</li><li><div class="fn" /><b><a href="qpainter.html#drawPixmap">drawPixmap</a></b> (<i>self</i>, QRectF&#160;<i>targetRect</i>, QPixmap&#160;<i>pixmap</i>, QRectF&#160;<i>sourceRect</i>)</li><li><div class="fn" /><b><a href="qpainter.html#drawPixmap-2">drawPixmap</a></b> (<i>self</i>, QRect&#160;<i>targetRect</i>, QPixmap&#160;<i>pixmap</i>, QRect&#160;<i>sourceRect</i>)</li><li><div class="fn" /><b><a href="qpainter.html#drawPixmap-3">drawPixmap</a></b> (<i>self</i>, QPointF&#160;<i>p</i>, QPixmap&#160;<i>pm</i>)</li><li><div class="fn" /><b><a href="qpainter.html#drawPixmap-4">drawPixmap</a></b> (<i>self</i>, QPoint&#160;<i>p</i>, QPixmap&#160;<i>pm</i>)</li><li><div class="fn" /><b><a href="qpainter.html#drawPixmap-5">drawPixmap</a></b> (<i>self</i>, QRect&#160;<i>r</i>, QPixmap&#160;<i>pm</i>)</li><li><div class="fn" /><b><a href="qpainter.html#drawPixmap-6">drawPixmap</a></b> (<i>self</i>, int&#160;<i>x</i>, int&#160;<i>y</i>, QPixmap&#160;<i>pm</i>)</li><li><div class="fn" /><b><a href="qpainter.html#drawPixmap-7">drawPixmap</a></b> (<i>self</i>, int&#160;<i>x</i>, int&#160;<i>y</i>, int&#160;<i>w</i>, int&#160;<i>h</i>, QPixmap&#160;<i>pm</i>)</li><li><div class="fn" /><b><a href="qpainter.html#drawPixmap-8">drawPixmap</a></b> (<i>self</i>, int&#160;<i>x</i>, int&#160;<i>y</i>, int&#160;<i>w</i>, int&#160;<i>h</i>, QPixmap&#160;<i>pm</i>, int&#160;<i>sx</i>, int&#160;<i>sy</i>, int&#160;<i>sw</i>, int&#160;<i>sh</i>)</li><li><div class="fn" /><b><a href="qpainter.html#drawPixmap-9">drawPixmap</a></b> (<i>self</i>, int&#160;<i>x</i>, int&#160;<i>y</i>, QPixmap&#160;<i>pm</i>, int&#160;<i>sx</i>, int&#160;<i>sy</i>, int&#160;<i>sw</i>, int&#160;<i>sh</i>)</li><li><div class="fn" /><b><a href="qpainter.html#drawPixmap-10">drawPixmap</a></b> (<i>self</i>, QPointF&#160;<i>p</i>, QPixmap&#160;<i>pm</i>, QRectF&#160;<i>sr</i>)</li><li><div class="fn" /><b><a href="qpainter.html#drawPixmap-11">drawPixmap</a></b> (<i>self</i>, QPoint&#160;<i>p</i>, QPixmap&#160;<i>pm</i>, QRect&#160;<i>sr</i>)</li><li><div class="fn" /><b><a href="qpainter.html#drawPixmapFragments">drawPixmapFragments</a></b> (<i>self</i>, list-of-QPainter.PixmapFragment&#160;<i>fragments</i>, QPixmap&#160;<i>pixmap</i>, PixmapFragmentHints&#160;<i>hints</i>&#160;=&#160;0)</li><li><div class="fn" /><b><a href="qpainter.html#drawPoint">drawPoint</a></b> (<i>self</i>, QPointF&#160;<i>p</i>)</li><li><div class="fn" /><b><a href="qpainter.html#drawPoint-2">drawPoint</a></b> (<i>self</i>, int&#160;<i>x</i>, int&#160;<i>y</i>)</li><li><div class="fn" /><b><a href="qpainter.html#drawPoint-3">drawPoint</a></b> (<i>self</i>, QPoint&#160;<i>p</i>)</li><li><div class="fn" /><b><a href="qpainter.html#drawPoints">drawPoints</a></b> (<i>self</i>, QPointF&#160;<i>point</i>, ...)</li><li><div class="fn" /><b><a href="qpainter.html#drawPoints-2">drawPoints</a></b> (<i>self</i>, QPolygonF&#160;<i>points</i>)</li><li><div class="fn" /><b><a href="qpainter.html#drawPoints-3">drawPoints</a></b> (<i>self</i>, QPoint&#160;<i>point</i>, ...)</li><li><div class="fn" /><b><a href="qpainter.html#drawPoints-4">drawPoints</a></b> (<i>self</i>, QPolygon&#160;<i>points</i>)</li><li><div class="fn" /><b><a href="qpainter.html#drawPolygon">drawPolygon</a></b> (<i>self</i>, QPointF&#160;<i>point</i>, ...)</li><li><div class="fn" /><b><a href="qpainter.html#drawPolygon-2">drawPolygon</a></b> (<i>self</i>, QPolygonF&#160;<i>points</i>, Qt.FillRule&#160;<i>fillRule</i>&#160;=&#160;Qt.OddEvenFill)</li><li><div class="fn" /><b><a href="qpainter.html#drawPolygon-3">drawPolygon</a></b> (<i>self</i>, QPoint&#160;<i>point</i>, ...)</li><li><div class="fn" /><b><a href="qpainter.html#drawPolygon-4">drawPolygon</a></b> (<i>self</i>, QPolygon&#160;<i>points</i>, Qt.FillRule&#160;<i>fillRule</i>&#160;=&#160;Qt.OddEvenFill)</li><li><div class="fn" /><b><a href="qpainter.html#drawPolyline">drawPolyline</a></b> (<i>self</i>, QPointF&#160;<i>point</i>, ...)</li><li><div class="fn" /><b><a href="qpainter.html#drawPolyline-2">drawPolyline</a></b> (<i>self</i>, QPolygonF&#160;<i>polyline</i>)</li><li><div class="fn" /><b><a href="qpainter.html#drawPolyline-3">drawPolyline</a></b> (<i>self</i>, QPoint&#160;<i>point</i>, ...)</li><li><div class="fn" /><b><a href="qpainter.html#drawPolyline-4">drawPolyline</a></b> (<i>self</i>, QPolygon&#160;<i>polyline</i>)</li><li><div class="fn" /><b><a href="qpainter.html#drawRect">drawRect</a></b> (<i>self</i>, QRectF&#160;<i>rect</i>)</li><li><div class="fn" /><b><a href="qpainter.html#drawRect-2">drawRect</a></b> (<i>self</i>, int&#160;<i>x</i>, int&#160;<i>y</i>, int&#160;<i>w</i>, int&#160;<i>h</i>)</li><li><div class="fn" /><b><a href="qpainter.html#drawRect-3">drawRect</a></b> (<i>self</i>, QRect&#160;<i>r</i>)</li><li><div class="fn" /><b><a href="qpainter.html#drawRects">drawRects</a></b> (<i>self</i>, QRectF&#160;<i>rect</i>, ...)</li><li><div class="fn" /><b><a href="qpainter.html#drawRects-2">drawRects</a></b> (<i>self</i>, list-of-QRectF&#160;<i>rects</i>)</li><li><div class="fn" /><b><a href="qpainter.html#drawRects-3">drawRects</a></b> (<i>self</i>, QRect&#160;<i>rect</i>, ...)</li><li><div class="fn" /><b><a href="qpainter.html#drawRects-4">drawRects</a></b> (<i>self</i>, list-of-QRect&#160;<i>rects</i>)</li><li><div class="fn" /><b><a href="qpainter.html#drawRoundedRect">drawRoundedRect</a></b> (<i>self</i>, QRectF&#160;<i>rect</i>, float&#160;<i>xRadius</i>, float&#160;<i>yRadius</i>, Qt.SizeMode&#160;<i>mode</i>&#160;=&#160;Qt.AbsoluteSize)</li><li><div class="fn" /><b><a href="qpainter.html#drawRoundedRect-2">drawRoundedRect</a></b> (<i>self</i>, int&#160;<i>x</i>, int&#160;<i>y</i>, int&#160;<i>w</i>, int&#160;<i>h</i>, float&#160;<i>xRadius</i>, float&#160;<i>yRadius</i>, Qt.SizeMode&#160;<i>mode</i>&#160;=&#160;Qt.AbsoluteSize)</li><li><div class="fn" /><b><a href="qpainter.html#drawRoundedRect-3">drawRoundedRect</a></b> (<i>self</i>, QRect&#160;<i>rect</i>, float&#160;<i>xRadius</i>, float&#160;<i>yRadius</i>, Qt.SizeMode&#160;<i>mode</i>&#160;=&#160;Qt.AbsoluteSize)</li><li><div class="fn" /><b><a href="qpainter.html#drawRoundRect">drawRoundRect</a></b> (<i>self</i>, QRectF&#160;<i>r</i>, int&#160;<i>xRound</i>&#160;=&#160;25, int&#160;<i>yRound</i>&#160;=&#160;25)</li><li><div class="fn" /><b><a href="qpainter.html#drawRoundRect-2">drawRoundRect</a></b> (<i>self</i>, int&#160;<i>x</i>, int&#160;<i>y</i>, int&#160;<i>w</i>, int&#160;<i>h</i>, int&#160;<i>xRound</i>&#160;=&#160;25, int&#160;<i>yRound</i>&#160;=&#160;25)</li><li><div class="fn" /><b><a href="qpainter.html#drawRoundRect-3">drawRoundRect</a></b> (<i>self</i>, QRect&#160;<i>r</i>, int&#160;<i>xRound</i>&#160;=&#160;25, int&#160;<i>yRound</i>&#160;=&#160;25)</li><li><div class="fn" /><b><a href="qpainter.html#drawStaticText">drawStaticText</a></b> (<i>self</i>, QPointF&#160;<i>topLeftPosition</i>, QStaticText&#160;<i>staticText</i>)</li><li><div class="fn" /><b><a href="qpainter.html#drawStaticText-2">drawStaticText</a></b> (<i>self</i>, QPoint&#160;<i>p</i>, QStaticText&#160;<i>staticText</i>)</li><li><div class="fn" /><b><a href="qpainter.html#drawStaticText-3">drawStaticText</a></b> (<i>self</i>, int&#160;<i>x</i>, int&#160;<i>y</i>, QStaticText&#160;<i>staticText</i>)</li><li><div class="fn" /><b><a href="qpainter.html#drawText">drawText</a></b> (<i>self</i>, QPointF&#160;<i>p</i>, QString&#160;<i>s</i>)</li><li><div class="fn" />QRectF&#160;<i>boundingRect</i> <b><a href="qpainter.html#drawText-2">drawText</a></b> (<i>self</i>, QRectF&#160;<i>rectangle</i>, int&#160;<i>flags</i>, QString&#160;<i>text</i>)</li><li><div class="fn" />QRect&#160;<i>boundingRect</i> <b><a href="qpainter.html#drawText-3">drawText</a></b> (<i>self</i>, QRect&#160;<i>rectangle</i>, int&#160;<i>flags</i>, QString&#160;<i>text</i>)</li><li><div class="fn" /><b><a href="qpainter.html#drawText-4">drawText</a></b> (<i>self</i>, QRectF&#160;<i>rectangle</i>, QString&#160;<i>text</i>, QTextOption&#160;<i>option</i>&#160;=&#160;QTextOption())</li><li><div class="fn" /><b><a href="qpainter.html#drawText-5">drawText</a></b> (<i>self</i>, QPoint&#160;<i>p</i>, QString&#160;<i>s</i>)</li><li><div class="fn" />QRect&#160;<i>boundingRect</i> <b><a href="qpainter.html#drawText-6">drawText</a></b> (<i>self</i>, int&#160;<i>x</i>, int&#160;<i>y</i>, int&#160;<i>width</i>, int&#160;<i>height</i>, int&#160;<i>flags</i>, QString&#160;<i>text</i>)</li><li><div class="fn" /><b><a href="qpainter.html#drawText-7">drawText</a></b> (<i>self</i>, int&#160;<i>x</i>, int&#160;<i>y</i>, QString&#160;<i>s</i>)</li><li><div class="fn" /><b><a href="qpainter.html#drawTiledPixmap">drawTiledPixmap</a></b> (<i>self</i>, QRectF&#160;<i>rectangle</i>, QPixmap&#160;<i>pixmap</i>, QPointF&#160;<i>pos</i>&#160;=&#160;QPointF())</li><li><div class="fn" /><b><a href="qpainter.html#drawTiledPixmap-2">drawTiledPixmap</a></b> (<i>self</i>, QRect&#160;<i>rectangle</i>, QPixmap&#160;<i>pixmap</i>, QPoint&#160;<i>pos</i>&#160;=&#160;QPoint())</li><li><div class="fn" /><b><a href="qpainter.html#drawTiledPixmap-3">drawTiledPixmap</a></b> (<i>self</i>, int&#160;<i>x</i>, int&#160;<i>y</i>, int&#160;<i>width</i>, int&#160;<i>height</i>, QPixmap&#160;<i>pixmap</i>, int&#160;<i>sx</i>&#160;=&#160;0, int&#160;<i>sy</i>&#160;=&#160;0)</li><li><div class="fn" />bool <b><a href="qpainter.html#end">end</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qpainter.html#endNativePainting">endNativePainting</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qpainter.html#eraseRect">eraseRect</a></b> (<i>self</i>, QRectF)</li><li><div class="fn" /><b><a href="qpainter.html#eraseRect-2">eraseRect</a></b> (<i>self</i>, QRect&#160;<i>rect</i>)</li><li><div class="fn" /><b><a href="qpainter.html#eraseRect-3">eraseRect</a></b> (<i>self</i>, int&#160;<i>x</i>, int&#160;<i>y</i>, int&#160;<i>w</i>, int&#160;<i>h</i>)</li><li><div class="fn" /><b><a href="qpainter.html#fillPath">fillPath</a></b> (<i>self</i>, QPainterPath&#160;<i>path</i>, QBrush&#160;<i>brush</i>)</li><li><div class="fn" /><b><a href="qpainter.html#fillRect">fillRect</a></b> (<i>self</i>, QRectF, QBrush)</li><li><div class="fn" /><b><a href="qpainter.html#fillRect-2">fillRect</a></b> (<i>self</i>, QRect, QBrush)</li><li><div class="fn" /><b><a href="qpainter.html#fillRect-3">fillRect</a></b> (<i>self</i>, int&#160;<i>x</i>, int&#160;<i>y</i>, int&#160;<i>w</i>, int&#160;<i>h</i>, QBrush&#160;<i>b</i>)</li><li><div class="fn" /><b><a href="qpainter.html#fillRect-4">fillRect</a></b> (<i>self</i>, QRectF, QColor&#160;<i>color</i>)</li><li><div class="fn" /><b><a href="qpainter.html#fillRect-5">fillRect</a></b> (<i>self</i>, QRect, QColor&#160;<i>color</i>)</li><li><div class="fn" /><b><a href="qpainter.html#fillRect-6">fillRect</a></b> (<i>self</i>, int&#160;<i>x</i>, int&#160;<i>y</i>, int&#160;<i>w</i>, int&#160;<i>h</i>, QColor&#160;<i>b</i>)</li><li><div class="fn" /><b><a href="qpainter.html#fillRect-7">fillRect</a></b> (<i>self</i>, int&#160;<i>x</i>, int&#160;<i>y</i>, int&#160;<i>w</i>, int&#160;<i>h</i>, Qt.GlobalColor&#160;<i>c</i>)</li><li><div class="fn" /><b><a href="qpainter.html#fillRect-8">fillRect</a></b> (<i>self</i>, QRect&#160;<i>r</i>, Qt.GlobalColor&#160;<i>c</i>)</li><li><div class="fn" /><b><a href="qpainter.html#fillRect-9">fillRect</a></b> (<i>self</i>, QRectF&#160;<i>r</i>, Qt.GlobalColor&#160;<i>c</i>)</li><li><div class="fn" /><b><a href="qpainter.html#fillRect-10">fillRect</a></b> (<i>self</i>, int&#160;<i>x</i>, int&#160;<i>y</i>, int&#160;<i>w</i>, int&#160;<i>h</i>, Qt.BrushStyle&#160;<i>style</i>)</li><li><div class="fn" /><b><a href="qpainter.html#fillRect-11">fillRect</a></b> (<i>self</i>, QRect&#160;<i>r</i>, Qt.BrushStyle&#160;<i>style</i>)</li><li><div class="fn" /><b><a href="qpainter.html#fillRect-12">fillRect</a></b> (<i>self</i>, QRectF&#160;<i>r</i>, Qt.BrushStyle&#160;<i>style</i>)</li><li><div class="fn" />QFont <b><a href="qpainter.html#font">font</a></b> (<i>self</i>)</li><li><div class="fn" />QFontInfo <b><a href="qpainter.html#fontInfo">fontInfo</a></b> (<i>self</i>)</li><li><div class="fn" />QFontMetrics <b><a href="qpainter.html#fontMetrics">fontMetrics</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qpainter.html#hasClipping">hasClipping</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qpainter.html#initFrom">initFrom</a></b> (<i>self</i>, QWidget&#160;<i>widget</i>)</li><li><div class="fn" />bool <b><a href="qpainter.html#isActive">isActive</a></b> (<i>self</i>)</li><li><div class="fn" />Qt.LayoutDirection <b><a href="qpainter.html#layoutDirection">layoutDirection</a></b> (<i>self</i>)</li><li><div class="fn" />QMatrix <b><a href="qpainter.html#matrix">matrix</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qpainter.html#matrixEnabled">matrixEnabled</a></b> (<i>self</i>)</li><li><div class="fn" />float <b><a href="qpainter.html#opacity">opacity</a></b> (<i>self</i>)</li><li><div class="fn" />QPaintEngine <b><a href="qpainter.html#paintEngine">paintEngine</a></b> (<i>self</i>)</li><li><div class="fn" />QPen <b><a href="qpainter.html#pen">pen</a></b> (<i>self</i>)</li><li><div class="fn" />RenderHints <b><a href="qpainter.html#renderHints">renderHints</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qpainter.html#resetMatrix">resetMatrix</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qpainter.html#resetTransform">resetTransform</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qpainter.html#restore">restore</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qpainter.html#rotate">rotate</a></b> (<i>self</i>, float&#160;<i>a</i>)</li><li><div class="fn" /><b><a href="qpainter.html#save">save</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qpainter.html#scale">scale</a></b> (<i>self</i>, float&#160;<i>sx</i>, float&#160;<i>sy</i>)</li><li><div class="fn" /><b><a href="qpainter.html#setBackground">setBackground</a></b> (<i>self</i>, QBrush&#160;<i>bg</i>)</li><li><div class="fn" /><b><a href="qpainter.html#setBackgroundMode">setBackgroundMode</a></b> (<i>self</i>, Qt.BGMode&#160;<i>mode</i>)</li><li><div class="fn" /><b><a href="qpainter.html#setBrush">setBrush</a></b> (<i>self</i>, QBrush&#160;<i>brush</i>)</li><li><div class="fn" /><b><a href="qpainter.html#setBrush-2">setBrush</a></b> (<i>self</i>, Qt.BrushStyle&#160;<i>style</i>)</li><li><div class="fn" /><b><a href="qpainter.html#setBrushOrigin">setBrushOrigin</a></b> (<i>self</i>, QPointF)</li><li><div class="fn" /><b><a href="qpainter.html#setBrushOrigin-2">setBrushOrigin</a></b> (<i>self</i>, int&#160;<i>x</i>, int&#160;<i>y</i>)</li><li><div class="fn" /><b><a href="qpainter.html#setBrushOrigin-3">setBrushOrigin</a></b> (<i>self</i>, QPoint&#160;<i>p</i>)</li><li><div class="fn" /><b><a href="qpainter.html#setClipPath">setClipPath</a></b> (<i>self</i>, QPainterPath&#160;<i>path</i>, Qt.ClipOperation&#160;<i>operation</i>&#160;=&#160;Qt.ReplaceClip)</li><li><div class="fn" /><b><a href="qpainter.html#setClipping">setClipping</a></b> (<i>self</i>, bool&#160;<i>enable</i>)</li><li><div class="fn" /><b><a href="qpainter.html#setClipRect">setClipRect</a></b> (<i>self</i>, QRectF&#160;<i>rectangle</i>, Qt.ClipOperation&#160;<i>operation</i>&#160;=&#160;Qt.ReplaceClip)</li><li><div class="fn" /><b><a href="qpainter.html#setClipRect-2">setClipRect</a></b> (<i>self</i>, int&#160;<i>x</i>, int&#160;<i>y</i>, int&#160;<i>width</i>, int&#160;<i>height</i>, Qt.ClipOperation&#160;<i>operation</i>&#160;=&#160;Qt.ReplaceClip)</li><li><div class="fn" /><b><a href="qpainter.html#setClipRect-3">setClipRect</a></b> (<i>self</i>, QRect&#160;<i>rectangle</i>, Qt.ClipOperation&#160;<i>operation</i>&#160;=&#160;Qt.ReplaceClip)</li><li><div class="fn" /><b><a href="qpainter.html#setClipRegion">setClipRegion</a></b> (<i>self</i>, QRegion&#160;<i>region</i>, Qt.ClipOperation&#160;<i>operation</i>&#160;=&#160;Qt.ReplaceClip)</li><li><div class="fn" /><b><a href="qpainter.html#setCompositionMode">setCompositionMode</a></b> (<i>self</i>, CompositionMode&#160;<i>mode</i>)</li><li><div class="fn" /><b><a href="qpainter.html#setFont">setFont</a></b> (<i>self</i>, QFont&#160;<i>f</i>)</li><li><div class="fn" /><b><a href="qpainter.html#setLayoutDirection">setLayoutDirection</a></b> (<i>self</i>, Qt.LayoutDirection&#160;<i>direction</i>)</li><li><div class="fn" /><b><a href="qpainter.html#setMatrix">setMatrix</a></b> (<i>self</i>, QMatrix&#160;<i>matrix</i>, bool&#160;<i>combine</i>&#160;=&#160;False)</li><li><div class="fn" /><b><a href="qpainter.html#setMatrixEnabled">setMatrixEnabled</a></b> (<i>self</i>, bool&#160;<i>enabled</i>)</li><li><div class="fn" /><b><a href="qpainter.html#setOpacity">setOpacity</a></b> (<i>self</i>, float&#160;<i>opacity</i>)</li><li><div class="fn" /><b><a href="qpainter.html#setPen">setPen</a></b> (<i>self</i>, QColor&#160;<i>color</i>)</li><li><div class="fn" /><b><a href="qpainter.html#setPen-2">setPen</a></b> (<i>self</i>, QPen&#160;<i>pen</i>)</li><li><div class="fn" /><b><a href="qpainter.html#setPen-3">setPen</a></b> (<i>self</i>, Qt.PenStyle&#160;<i>style</i>)</li><li><div class="fn" /><b><a href="qpainter.html#setRenderHint">setRenderHint</a></b> (<i>self</i>, RenderHint&#160;<i>hint</i>, bool&#160;<i>on</i>&#160;=&#160;True)</li><li><div class="fn" /><b><a href="qpainter.html#setRenderHints">setRenderHints</a></b> (<i>self</i>, RenderHints&#160;<i>hints</i>, bool&#160;<i>on</i>&#160;=&#160;True)</li><li><div class="fn" /><b><a href="qpainter.html#setTransform">setTransform</a></b> (<i>self</i>, QTransform&#160;<i>transform</i>, bool&#160;<i>combine</i>&#160;=&#160;False)</li><li><div class="fn" /><b><a href="qpainter.html#setViewport">setViewport</a></b> (<i>self</i>, QRect&#160;<i>viewport</i>)</li><li><div class="fn" /><b><a href="qpainter.html#setViewport-2">setViewport</a></b> (<i>self</i>, int&#160;<i>x</i>, int&#160;<i>y</i>, int&#160;<i>w</i>, int&#160;<i>h</i>)</li><li><div class="fn" /><b><a href="qpainter.html#setViewTransformEnabled">setViewTransformEnabled</a></b> (<i>self</i>, bool&#160;<i>enable</i>)</li><li><div class="fn" /><b><a href="qpainter.html#setWindow">setWindow</a></b> (<i>self</i>, QRect&#160;<i>window</i>)</li><li><div class="fn" /><b><a href="qpainter.html#setWindow-2">setWindow</a></b> (<i>self</i>, int&#160;<i>x</i>, int&#160;<i>y</i>, int&#160;<i>w</i>, int&#160;<i>h</i>)</li><li><div class="fn" /><b><a href="qpainter.html#setWorldMatrix">setWorldMatrix</a></b> (<i>self</i>, QMatrix&#160;<i>matrix</i>, bool&#160;<i>combine</i>&#160;=&#160;False)</li><li><div class="fn" /><b><a href="qpainter.html#setWorldMatrixEnabled">setWorldMatrixEnabled</a></b> (<i>self</i>, bool&#160;<i>enabled</i>)</li><li><div class="fn" /><b><a href="qpainter.html#setWorldTransform">setWorldTransform</a></b> (<i>self</i>, QTransform&#160;<i>matrix</i>, bool&#160;<i>combine</i>&#160;=&#160;False)</li><li><div class="fn" /><b><a href="qpainter.html#shear">shear</a></b> (<i>self</i>, float&#160;<i>sh</i>, float&#160;<i>sv</i>)</li><li><div class="fn" /><b><a href="qpainter.html#strokePath">strokePath</a></b> (<i>self</i>, QPainterPath&#160;<i>path</i>, QPen&#160;<i>pen</i>)</li><li><div class="fn" />bool <b><a href="qpainter.html#testRenderHint">testRenderHint</a></b> (<i>self</i>, RenderHint&#160;<i>hint</i>)</li><li><div class="fn" />QTransform <b><a href="qpainter.html#transform">transform</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qpainter.html#translate">translate</a></b> (<i>self</i>, QPointF&#160;<i>offset</i>)</li><li><div class="fn" /><b><a href="qpainter.html#translate-2">translate</a></b> (<i>self</i>, float&#160;<i>dx</i>, float&#160;<i>dy</i>)</li><li><div class="fn" /><b><a href="qpainter.html#translate-3">translate</a></b> (<i>self</i>, QPoint&#160;<i>offset</i>)</li><li><div class="fn" />QRect <b><a href="qpainter.html#viewport">viewport</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qpainter.html#viewTransformEnabled">viewTransformEnabled</a></b> (<i>self</i>)</li><li><div class="fn" />QRect <b><a href="qpainter.html#window">window</a></b> (<i>self</i>)</li><li><div class="fn" />QMatrix <b><a href="qpainter.html#worldMatrix">worldMatrix</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qpainter.html#worldMatrixEnabled">worldMatrixEnabled</a></b> (<i>self</i>)</li><li><div class="fn" />QTransform <b><a href="qpainter.html#worldTransform">worldTransform</a></b> (<i>self</i>)</li></ul><h3>Static Methods</h3><ul><li><div class="fn" />QPaintDevice <b><a href="qpainter.html#redirected">redirected</a></b> (QPaintDevice&#160;<i>device</i>, QPoint&#160;<i>offset</i>&#160;=&#160;None)</li><li><div class="fn" /><b><a href="qpainter.html#restoreRedirected">restoreRedirected</a></b> (QPaintDevice&#160;<i>device</i>)</li><li><div class="fn" /><b><a href="qpainter.html#setRedirected">setRedirected</a></b> (QPaintDevice&#160;<i>device</i>, QPaintDevice&#160;<i>replacement</i>, QPoint&#160;<i>offset</i>&#160;=&#160;QPoint())</li></ul><h3>Special Methods</h3><ul><li><div class="fn" />object <b><a href="qpainter.html#__enter__">__enter__</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qpainter.html#__exit__">__exit__</a></b> (<i>self</i>, object&#160;<i>type</i>, object&#160;<i>value</i>, object&#160;<i>traceback</i>)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QPainter class performs low-level painting on widgets and
other paint devices.</p>
<p>QPainter provides highly optimized functions to do most of the
drawing GUI programs require. It can draw everything from simple
lines to complex shapes like pies and chords. It can also draw
aligned text and pixmaps. Normally, it draws in a "natural"
coordinate system, but it can also do view and world
transformation. QPainter can operate on any object that inherits
the <a href="qpaintdevice.html">QPaintDevice</a> class.</p>
<p>The common use of QPainter is inside a widget's paint event:
Construct and customize (e.g. set the pen or the brush) the
painter. Then draw. Remember to destroy the QPainter object after
drawing. For example:</p>
<pre class="cpp">
 <span class="type">void</span> SimpleExampleWidget<span class="operator">.</span>paintEvent(<span class="type"><a href="qpaintevent.html">QPaintEvent</a></span> <span class="operator">*</span>)
 {
     <span class="type">QPainter</span> painter(<span class="keyword">this</span>);
     painter<span class="operator">.</span>setPen(<span class="type"><a href="qt.html">Qt</a></span><span class="operator">.</span>blue);
     painter<span class="operator">.</span>setFont(<span class="type"><a href="qfont.html">QFont</a></span>(<span class="string">"Arial"</span><span class="operator">,</span> <span class="number">30</span>));
     painter<span class="operator">.</span>drawText(rect()<span class="operator">,</span> <span class="type"><a href="qt.html">Qt</a></span><span class="operator">.</span>AlignCenter<span class="operator">,</span> <span class="string">"Qt"</span>);
 }
</pre>
<p>The core functionality of QPainter is drawing, but the class
also provide several functions that allows you to customize
QPainter's settings and its rendering quality, and others that
enable clipping. In addition you can control how different shapes
are merged together by specifying the painter's composition
mode.</p>
<p>The <a href="qpainter.html#isActive">isActive</a>() function
indicates whether the painter is active. A painter is activated by
the <a href="qpainter.html#begin">begin</a>() function and the
constructor that takes a <a href="qpaintdevice.html">QPaintDevice</a> argument. The <a href="qpainter.html#end">end</a>() function, and the destructor,
deactivates it.</p>
<p>Together with the <a href="qpaintdevice.html">QPaintDevice</a>
and <a href="qpaintengine.html">QPaintEngine</a> classes, QPainter
form the basis for Qt's paint system. QPainter is the class used to
perform drawing operations. <a href="qpaintdevice.html">QPaintDevice</a> represents a device that can
be painted on using a QPainter. <a href="qpaintengine.html">QPaintEngine</a> provides the interface that
the painter uses to draw onto different types of devices. If the
painter is active, <a href="qpainter.html#device">device</a>()
returns the paint device on which the painter paints, and <a href="qpainter.html#paintEngine">paintEngine</a>() returns the paint
engine that the painter is currently operating on. For more
information, see the <a href="paintsystem.html">Paint
System</a>.</p>
<p>Sometimes it is desirable to make someone else paint on an
unusual <a href="qpaintdevice.html">QPaintDevice</a>. QPainter
supports a static function to do this, <a class="obsolete" href="qpainter-obsolete.html#setRedirected">setRedirected</a>().</p>
<p><b>Warning:</b> When the paintdevice is a widget, QPainter can
only be used inside a paintEvent() function or in a function called
by paintEvent(); that is unless the <a href="qt.html#WidgetAttribute-enum">Qt.WA_PaintOutsidePaintEvent</a>
widget attribute is set. On Mac OS X and Windows, you can only
paint in a paintEvent() function regardless of this attribute's
setting.</p>
<a id="settings" name="settings" />
<h3>Settings</h3>
<p>There are several settings that you can customize to make
QPainter draw according to your preferences:</p>
<ul>
<li><a href="qpainter.html#font">font</a>() is the font used for
drawing text. If the painter <a href="qpainter.html#isActive">isActive</a>(), you can retrieve
information about the currently set font, and its metrics, using
the <a href="qpainter.html#fontInfo">fontInfo</a>() and <a href="qpainter.html#fontMetrics">fontMetrics</a>() functions
respectively.</li>
<li><a href="qpainter.html#brush">brush</a>() defines the color or
pattern that is used for filling shapes.</li>
<li><a href="qpainter.html#pen">pen</a>() defines the color or
stipple that is used for drawing lines or boundaries.</li>
<li><a href="qpainter.html#backgroundMode">backgroundMode</a>()
defines whether there is a <a href="qpainter.html#background">background</a>() or not, i.e it is
either <a href="qt.html#BGMode-enum">Qt.OpaqueMode</a> or <a href="qt.html#BGMode-enum">Qt.TransparentMode</a>.</li>
<li><a href="qpainter.html#background">background</a>() only
applies when <a href="qpainter.html#backgroundMode">backgroundMode</a>() is <a href="qt.html#BGMode-enum">Qt.OpaqueMode</a> and <a href="qpainter.html#pen">pen</a>() is a stipple. In that case, it
describes the color of the background pixels in the stipple.</li>
<li><a href="qpainter.html#brushOrigin">brushOrigin</a>() defines
the origin of the tiled brushes, normally the origin of widget's
background.</li>
<li><a href="qpainter.html#viewport">viewport</a>(), <a href="qpainter.html#window">window</a>(), <a href="qpainter.html#worldTransform">worldTransform</a>() make up the
painter's coordinate transformation system. For more information,
see the <a href="#coordinate-transformations">Coordinate
Transformations</a> section and the <a href="coordsys.html">Coordinate System</a> documentation.</li>
<li><a href="qpainter.html#hasClipping">hasClipping</a>() tells
whether the painter clips at all. (The paint device clips, too.) If
the painter clips, it clips to <a href="qpainter.html#clipRegion">clipRegion</a>().</li>
<li><a href="qpainter.html#layoutDirection">layoutDirection</a>()
defines the layout direction used by the painter when drawing
text.</li>
<li><a href="qpainter.html#worldMatrixEnabled">worldMatrixEnabled</a>() tells
whether world transformation is enabled.</li>
<li><a href="qpainter.html#viewTransformEnabled">viewTransformEnabled</a>()
tells whether view transformation is enabled.</li>
</ul>
<p>Note that some of these settings mirror settings in some paint
devices, e.g. <a href="qwidget.html#font-prop">QWidget.font</a>().
The <a href="qpainter.html#begin">QPainter.begin</a>() function
(or equivalently the QPainter constructor) copies these attributes
from the paint device.</p>
<p>You can at any time save the QPainter's state by calling the
<a href="qpainter.html#save">save</a>() function which saves all
the available settings on an internal stack. The <a href="qpainter.html#restore">restore</a>() function pops them back.</p>
<a id="drawing" name="drawing" />
<h3>Drawing</h3>
<p>QPainter provides functions to draw most primitives: <a href="qpainter.html#drawPoint">drawPoint</a>(), <a href="qpainter.html#drawPoints">drawPoints</a>(), <a href="qpainter.html#drawLine">drawLine</a>(), <a href="qpainter.html#drawRect">drawRect</a>(), <a href="qpainter.html#drawRoundedRect">drawRoundedRect</a>(), <a href="qpainter.html#drawEllipse">drawEllipse</a>(), <a href="qpainter.html#drawArc">drawArc</a>(), <a href="qpainter.html#drawPie">drawPie</a>(), <a href="qpainter.html#drawChord">drawChord</a>(), <a href="qpainter.html#drawPolyline">drawPolyline</a>(), <a href="qpainter.html#drawPolygon">drawPolygon</a>(), <a href="qpainter.html#drawConvexPolygon">drawConvexPolygon</a>() and
<a class="compat" href="qpainter-qt3.html#drawCubicBezier">drawCubicBezier</a>(). The two convenience functions,
<a href="qpainter.html#drawRects">drawRects</a>() and <a href="qpainter.html#drawLines">drawLines</a>(), draw the given number of
rectangles or lines in the given array of <a href="qrect.html">QRects</a> or <a href="qline.html">QLines</a> using
the current pen and brush.</p>
<p>The QPainter class also provides the <a href="qpainter.html#fillRect">fillRect</a>() function which fills the
given <a href="qrect.html">QRect</a>, with the given <a href="qbrush.html">QBrush</a>, and the <a href="qpainter.html#eraseRect">eraseRect</a>() function that erases the
area inside the given rectangle.</p>
<p>All of these functions have both integer and floating point
versions.</p>
<table class="generic" width="100%">
<tr class="odd" valign="top">
<td><img src="images/qpainter-basicdrawing.png" /></td>
<td><b>Basic Drawing Example</b>
<p>The <a href="painting-basicdrawing.html">Basic Drawing</a>
example shows how to display basic graphics primitives in a variety
of styles using the QPainter class.</p>
</td>
</tr>
</table>
<p>If you need to draw a complex shape, especially if you need to
do so repeatedly, consider creating a <a href="qpainterpath.html">QPainterPath</a> and drawing it using <a href="qpainter.html#drawPath">drawPath</a>().</p>
<table class="generic" width="100%">
<tr class="odd" valign="top">
<td><b>Painter Paths example</b>
<p>The <a href="qpainterpath.html">QPainterPath</a> class provides
a container for painting operations, enabling graphical shapes to
be constructed and reused.</p>
<p>The <a href="painting-painterpaths.html">Painter Paths</a>
example shows how painter paths can be used to build complex shapes
for rendering.</p>
</td>
<td><img src="images/qpainter-painterpaths.png" /></td>
</tr>
</table>
<p>QPainter also provides the <a href="qpainter.html#fillPath">fillPath</a>() function which fills the
given <a href="qpainterpath.html">QPainterPath</a> with the given
<a href="qbrush.html">QBrush</a>, and the <a href="qpainter.html#strokePath">strokePath</a>() function that draws the
outline of the given path (i.e. strokes the path).</p>
<p>See also the <a href="demos-deform.html">Vector Deformation</a>
demo which shows how to use advanced vector techniques to draw text
using a <a href="qpainterpath.html">QPainterPath</a>, the <a href="demos-gradients.html">Gradients</a> demo which shows the different
types of gradients that are available in Qt, and the <a href="demos-pathstroke.html">Path Stroking</a> demo which shows Qt's
built-in dash patterns and shows how custom patterns can be used to
extend the range of available patterns.</p>
<table class="generic">
<thead>
<tr class="qt-style">
<th><a href="demos-deform.html">Vector Deformation</a></th>
<th><a href="demos-gradients.html">Gradients</a></th>
<th><a href="demos-pathstroke.html">Path Stroking</a></th>
</tr>
</thead>
<tr class="odd" valign="top">
<td><img src="images/qpainter-vectordeformation.png" /></td>
<td><img src="images/qpainter-gradients.png" /></td>
<td><img src="images/qpainter-pathstroking.png" /></td>
</tr>
</table>
<p>There are functions to draw pixmaps/images, namely <a href="qpainter.html#drawPixmap">drawPixmap</a>(), <a href="qpainter.html#drawImage">drawImage</a>() and <a href="qpainter.html#drawTiledPixmap">drawTiledPixmap</a>(). Both
<a href="qpainter.html#drawPixmap">drawPixmap</a>() and <a href="qpainter.html#drawImage">drawImage</a>() produce the same result,
except that <a href="qpainter.html#drawPixmap">drawPixmap</a>() is
faster on-screen while <a href="qpainter.html#drawImage">drawImage</a>() may be faster on a
<a href="qprinter.html">QPrinter</a> or other devices.</p>
<p>Text drawing is done using <a href="qpainter.html#drawText">drawText</a>(). When you need fine-grained
positioning, <a href="qpainter.html#boundingRect">boundingRect</a>() tells you where a
given <a href="qpainter.html#drawText">drawText</a>() command will
draw.</p>
<p>There is a <a href="qpainter.html#drawPicture">drawPicture</a>()
function that draws the contents of an entire <a href="qpicture.html">QPicture</a>. The <a href="qpainter.html#drawPicture">drawPicture</a>() function is the only
function that disregards all the painter's settings as <a href="qpicture.html">QPicture</a> has its own settings.</p>
<a id="rendering-quality" name="rendering-quality" />
<h3>Rendering Quality</h3>
<p>To get the optimal rendering result using QPainter, you should
use the platform independent <a href="qimage.html">QImage</a> as
paint device; i.e. using <a href="qimage.html">QImage</a> will
ensure that the result has an identical pixel representation on any
platform.</p>
<p>The QPainter class also provides a means of controlling the
rendering quality through its <a href="qpainter.html#RenderHint-enum">RenderHint</a> enum and the support
for floating point precision: All the functions for drawing
primitives has a floating point version. These are often used in
combination with the <a href="qpainter.html#RenderHint-enum">QPainter.Antialiasing</a> render
hint.</p>
<table class="generic" width="100%">
<tr class="odd" valign="top">
<td><img src="images/qpainter-concentriccircles.png" /></td>
<td><b>Concentric Circles Example</b>
<p>The <a href="painting-concentriccircles.html">Concentric
Circles</a> example shows the improved rendering quality that can
be obtained using floating point precision and anti-aliasing when
drawing custom widgets.</p>
<p>The application's main window displays several widgets which are
drawn using the various combinations of precision and
anti-aliasing.</p>
</td>
</tr>
</table>
<p>The <a href="qpainter.html#RenderHint-enum">RenderHint</a> enum
specifies flags to QPainter that may or may not be respected by any
given engine. <a href="qpainter.html#RenderHint-enum">QPainter.Antialiasing</a>
indicates that the engine should antialias edges of primitives if
possible, <a href="qpainter.html#RenderHint-enum">QPainter.TextAntialiasing</a>
indicates that the engine should antialias text if possible, and
the <a href="qpainter.html#RenderHint-enum">QPainter.SmoothPixmapTransform</a>
indicates that the engine should use a smooth pixmap transformation
algorithm. <a href="qpainter.html#RenderHint-enum">HighQualityAntialiasing</a> is an
OpenGL-specific rendering hint indicating that the engine should
use fragment programs and offscreen rendering for antialiasing.</p>
<p>The <a href="qpainter.html#renderHints">renderHints</a>()
function returns a flag that specifies the rendering hints that are
set for this painter. Use the <a href="qpainter.html#setRenderHint">setRenderHint</a>() function to set
or clear the currently set <a href="qpainter.html#RenderHint-enum">RenderHints</a>.</p>
<a id="coordinate-transformations" name="coordinate-transformations" />
<h3>Coordinate Transformations</h3>
<p>Normally, the QPainter operates on the device's own coordinate
system (usually pixels), but QPainter has good support for
coordinate transformations.</p>
<table class="generic">
<thead>
<tr class="qt-style">
<th>nop</th>
<th><a href="qpainter.html#rotate">rotate</a>()</th>
<th><a href="qpainter.html#scale">scale</a>()</th>
<th><a href="qpainter.html#translate">translate</a>()</th>
</tr>
</thead>
<tr class="odd" valign="top">
<td><img src="images/qpainter-clock.png" /></td>
<td><img src="images/qpainter-rotation.png" /></td>
<td><img src="images/qpainter-scale.png" /></td>
<td><img src="images/qpainter-translation.png" /></td>
</tr>
</table>
<p>The most commonly used transformations are scaling, rotation,
translation and shearing. Use the <a href="qpainter.html#scale">scale</a>() function to scale the coordinate
system by a given offset, the <a href="qpainter.html#rotate">rotate</a>() function to rotate it clockwise
and <a href="qpainter.html#translate">translate</a>() to translate
it (i.e. adding a given offset to the points). You can also twist
the coordinate system around the origin using the <a href="qpainter.html#shear">shear</a>() function. See the <a href="demos-affine.html">Affine Transformations</a> demo for a
visualization of a sheared coordinate system.</p>
<p>See also the <a href="painting-transformations.html">Transformations</a> example which
shows how transformations influence the way that QPainter renders
graphics primitives. In particular it shows how the order of
transformations affects the result.</p>
<table class="generic" width="100%">
<tr class="odd" valign="top">
<td><b>Affine Transformations Demo</b>
<p>The <a href="demos-affine.html">Affine Transformations</a> demo
show Qt's ability to perform affine transformations on painting
operations. The demo also allows the user to experiment with the
transformation operations and see the results immediately.</p>
</td>
<td><img src="images/qpainter-affinetransformations.png" /></td>
</tr>
</table>
<p>All the tranformation operations operate on the transformation
<a href="qpainter.html#worldTransform">worldTransform</a>(). A
matrix transforms a point in the plane to another point. For more
information about the transformation matrix, see the <a href="coordsys.html">Coordinate System</a> and <a href="qtransform.html">QTransform</a> documentation.</p>
<p>The <a href="qpainter.html#setWorldTransform">setWorldTransform</a>() function
can replace or add to the currently set <a href="qpainter.html#worldTransform">worldTransform</a>(). The <a href="qpainter.html#resetTransform">resetTransform</a>() function resets
any transformations that were made using <a href="qpainter.html#translate">translate</a>(), <a href="qpainter.html#scale">scale</a>(), <a href="qpainter.html#shear">shear</a>(), <a href="qpainter.html#rotate">rotate</a>(), <a href="qpainter.html#setWorldTransform">setWorldTransform</a>(), <a href="qpainter.html#setViewport">setViewport</a>() and <a href="qpainter.html#setWindow">setWindow</a>() functions. The <a href="qpainter.html#deviceTransform">deviceTransform</a>() returns the
matrix that transforms from logical coordinates to device
coordinates of the platform dependent paint device. The latter
function is only needed when using platform painting commands on
the platform dependent handle, and the platform does not do
transformations nativly.</p>
<p>When drawing with QPainter, we specify points using logical
coordinates which then are converted into the physical coordinates
of the paint device. The mapping of the logical coordinates to the
physical coordinates are handled by QPainter's <a href="qpainter.html#combinedTransform">combinedTransform</a>(), a
combination of <a href="qpainter.html#viewport">viewport</a>() and
<a href="qpainter.html#window">window</a>() and <a href="qpainter.html#worldTransform">worldTransform</a>(). The <a href="qpainter.html#viewport">viewport</a>() represents the physical
coordinates specifying an arbitrary rectangle, the <a href="qpainter.html#window">window</a>() describes the same rectangle in
logical coordinates, and the <a href="qpainter.html#worldTransform">worldTransform</a>() is identical
with the transformation matrix.</p>
<p>See also <a href="coordsys.html">Coordinate System</a></p>
<a id="clipping" name="clipping" />
<h3>Clipping</h3>
<p>QPainter can clip any drawing operation to a rectangle, a
region, or a vector path. The current clip is available using the
functions <a href="qpainter.html#clipRegion">clipRegion</a>() and
<a href="qpainter.html#clipPath">clipPath</a>(). Whether paths or
regions are preferred (faster) depends on the underlying <a href="qpainter.html#paintEngine">paintEngine</a>(). For example, the
<a href="qimage.html">QImage</a> paint engine prefers paths while
the X11 paint engine prefers regions. Setting a clip is done in the
painters logical coordinates.</p>
<p>After QPainter's clipping, the paint device may also clip. For
example, most widgets clip away the pixels used by child widgets,
and most printers clip away an area near the edges of the paper.
This additional clipping is not reflected by the return value of
<a href="qpainter.html#clipRegion">clipRegion</a>() or <a href="qpainter.html#hasClipping">hasClipping</a>().</p>
<a id="composition-modes" name="composition-modes" />
<h3>Composition Modes</h3>
<a id="composition-modes" name="composition-modes" />
<p>QPainter provides the <a href="qpainter.html#CompositionMode-enum">CompositionMode</a> enum which
defines the Porter-Duff rules for digital image compositing; it
describes a model for combining the pixels in one image, the
source, with the pixels in another image, the destination.</p>
<p>The two most common forms of composition are <a href="qpainter.html#CompositionMode-enum">Source</a> and <a href="qpainter.html#CompositionMode-enum">SourceOver</a>. <a href="qpainter.html#CompositionMode-enum">Source</a> is used to draw
opaque objects onto a paint device. In this mode, each pixel in the
source replaces the corresponding pixel in the destination. In
<a href="qpainter.html#CompositionMode-enum">SourceOver</a>
composition mode, the source object is transparent and is drawn on
top of the destination.</p>
<p>Note that composition transformation operates pixelwise. For
that reason, there is a difference between using the graphic
primitive itself and its bounding rectangle: The bounding rect
contains pixels with alpha == 0 (i.e the pixels surrounding the
primitive). These pixels will overwrite the other image's pixels,
affectively clearing those, while the primitive only overwrites its
own area.</p>
<table class="generic" width="100%">
<tr class="odd" valign="top">
<td><img src="images/qpainter-compositiondemo.png" /></td>
<td><b>Composition Modes Demo</b>
<p>The <a href="demos-composition.html">Composition Modes</a> demo,
available in Qt's demo directory, allows you to experiment with the
various composition modes and see the results immediately.</p>
</td>
</tr>
</table>
<a id="limitations" name="limitations" />
<h3>Limitations</h3>
<a id="limitations" name="limitations" />
<p>If you are using coordinates with Qt's raster-based paint
engine, it is important to note that, while coordinates greater
than +/- 2<sup>15</sup> can be used, any painting performed with
coordinates outside this range is not guaranteed to be shown; the
drawing may be clipped. This is due to the use of <tt>short
int</tt> in the implementation.</p>
<p>The outlines generated by Qt's stroker are only an approximation
when dealing with curved shapes. It is in most cases impossible to
represent the outline of a bezier curve segment using another
bezier curve segment, and so Qt approximates the curve outlines by
using several smaller curves. For performance reasons there is a
limit to how many curves Qt uses for these outlines, and thus when
using large pen widths or scales the outline error increases. To
generate outlines with smaller errors it is possible to use the
<a href="qpainterpathstroker.html">QPainterPathStroker</a> class,
which has the setCurveThreshold member function which let's the
user specify the error tolerance. Another workaround is to convert
the paths to polygons first and then draw the polygons instead.</p>
<a id="performance" name="performance" />
<h3>Performance</h3>
<p>QPainter is a rich framework that allows developers to do a
great variety of graphical operations, such as gradients,
composition modes and vector graphics. And QPainter can do this
across a variety of different hardware and software stacks.
Naturally the underlying combination of hardware and software has
some implications for performance, and ensuring that every single
operation is fast in combination with all the various combinations
of composition modes, brushes, clipping, transformation, etc, is
close to an impossible task because of the number of permutations.
As a compromise we have selected a subset of the QPainter API and
backends, where performance is guaranteed to be as good as we can
sensibly get it for the given combination of hardware and
software.</p>
<p>The backends we focus on as high-performance engines are:</p>
<ul>
<li>Raster - This backend implements all rendering in pure software
and is always used to render into QImages. For optimal performance
only use the format types <a href="qimage.html#Format-enum">QImage.Format_ARGB32_Premultiplied</a>,
<a href="qimage.html#Format-enum">QImage.Format_RGB32</a> or
<a href="qimage.html#Format-enum">QImage.Format_RGB16</a>. Any
other format, including <a href="qimage.html#Format-enum">QImage.Format_ARGB32</a>, has
significantly worse performance. This engine is also used by
default on Windows and on QWS. It can be used as default graphics
system on any OS/hardware/software combination by passing
<tt>-graphicssystem raster</tt> on the command line</li>
<li>OpenGL 2.0 (ES) - This backend is the primary backend for
hardware accelerated graphics. It can be run on desktop machines
and embedded devices supporting the OpenGL 2.0 or OpenGL/ES 2.0
specification. This includes most graphics chips produced in the
last couple of years. The engine can be enabled by using QPainter
onto a <a href="qglwidget.html">QGLWidget</a> or by passing
<tt>-graphicssystem opengl</tt> on the command line when the
underlying system supports it.</li>
<li>OpenVG - This backend implements the Khronos standard for 2D
and Vector Graphics. It is primarily for embedded devices with
hardware support for OpenVG. The engine can be enabled by passing
<tt>-graphicssystem openvg</tt> on the command line when the
underlying system supports it.</li>
</ul>
<p>These operations are:</p>
<ul>
<li>Simple transformations, meaning translation and scaling, pluss
0, 90, 180, 270 degree rotations.</li>
<li><tt>drawPixmap()</tt> in combination with simple
transformations and opacity with non-smooth transformation mode
(<tt>QPainter.SmoothPixmapTransform</tt> not enabled as a render
hint).</li>
<li>Rectangle fills with solid color, two-color linear gradients
and simple transforms.</li>
<li>Rectangular clipping with simple transformations and intersect
clip.</li>
<li>Composition Modes <tt>QPainter.CompositionMode_Source</tt> and
<a href="qpainter.html#CompositionMode-enum">QPainter.CompositionMode_SourceOver</a></li>
<li>Rounded rectangle filling using solid color and two-color
linear gradients fills.</li>
<li>3x3 patched pixmaps, via qDrawBorderPixmap.</li>
</ul>
<p>This list gives an indication of which features to safely use in
an application where performance is critical. For certain setups,
other operations may be fast too, but before making extensive use
of them, it is recommended to benchmark and verify them on the
system where the software will run in the end. There are also cases
where expensive operations are ok to use, for instance when the
result is cached in a <a href="qpixmap.html">QPixmap</a>.</p>
<hr /><h2>Type Documentation</h2><h3 class="fn"><a name="CompositionMode-enum" />QPainter.CompositionMode</h3><p>Defines the modes supported for digital image compositing.
Composition modes are used to specify how the pixels in one image,
the source, are merged with the pixel in another image, the
destination.</p>
<p>Please note that the bitwise raster operation modes, denoted
with a RasterOp prefix, are only natively supported in the X11 and
raster paint engines. This means that the only way to utilize these
modes on the Mac is via a <a href="qimage.html">QImage</a>. The
RasterOp denoted blend modes are <i>not</i> supported for pens and
brushes with alpha components. Also, turning on the <a href="qpainter.html#RenderHint-enum">QPainter.Antialiasing</a> render
hint will effectively disable the RasterOp modes.</p>
<p class="centerAlign"><img src="images/qpainter-compositionmode1.png" /></p>
<p class="centerAlign"><img src="images/qpainter-compositionmode2.png" /></p>
<p>The most common type is SourceOver (often referred to as just
alpha blending) where the source pixel is blended on top of the
destination pixel in such a way that the alpha component of the
source defines the translucency of the pixel.</p>
<p>When the paint device is a <a href="qimage.html">QImage</a>, the
image format must be set to <a href="qimage.html#Format-enum">Format_ARGB32Premultiplied</a> or
<a href="qimage.html#Format-enum">Format_ARGB32</a> for the
composition modes to have any effect. For performance the
premultiplied version is the preferred format.</p>
<p>When a composition mode is set it applies to all painting
operator, pens, brushes, gradients and pixmap/image drawing.</p>
<table class="valuelist">
<tr class="odd" valign="top">
<th class="tblConst">Constant</th>
<th class="tblval">Value</th>
<th class="tbldscr">Description</th>
</tr>
<tr>
<td class="topAlign">
<tt>QPainter.CompositionMode_SourceOver</tt></td>
<td class="topAlign"><tt>0</tt></td>
<td class="topAlign">This is the default mode. The alpha of the
source is used to blend the pixel on top of the destination.</td>
</tr>
<tr>
<td class="topAlign">
<tt>QPainter.CompositionMode_DestinationOver</tt></td>
<td class="topAlign"><tt>1</tt></td>
<td class="topAlign">The alpha of the destination is used to blend
it on top of the source pixels. This mode is the inverse of
CompositionMode_SourceOver.</td>
</tr>
<tr>
<td class="topAlign"><tt>QPainter.CompositionMode_Clear</tt></td>
<td class="topAlign"><tt>2</tt></td>
<td class="topAlign">The pixels in the destination are cleared (set
to fully transparent) independent of the source.</td>
</tr>
<tr>
<td class="topAlign"><tt>QPainter.CompositionMode_Source</tt></td>
<td class="topAlign"><tt>3</tt></td>
<td class="topAlign">The output is the source pixel. (This means a
basic copy operation and is identical to SourceOver when the source
pixel is opaque).</td>
</tr>
<tr>
<td class="topAlign">
<tt>QPainter.CompositionMode_Destination</tt></td>
<td class="topAlign"><tt>4</tt></td>
<td class="topAlign">The output is the destination pixel. This
means that the blending has no effect. This mode is the inverse of
CompositionMode_Source.</td>
</tr>
<tr>
<td class="topAlign">
<tt>QPainter.CompositionMode_SourceIn</tt></td>
<td class="topAlign"><tt>5</tt></td>
<td class="topAlign">The output is the source, where the alpha is
reduced by that of the destination.</td>
</tr>
<tr>
<td class="topAlign">
<tt>QPainter.CompositionMode_DestinationIn</tt></td>
<td class="topAlign"><tt>6</tt></td>
<td class="topAlign">The output is the destination, where the alpha
is reduced by that of the source. This mode is the inverse of
CompositionMode_SourceIn.</td>
</tr>
<tr>
<td class="topAlign">
<tt>QPainter.CompositionMode_SourceOut</tt></td>
<td class="topAlign"><tt>7</tt></td>
<td class="topAlign">The output is the source, where the alpha is
reduced by the inverse of destination.</td>
</tr>
<tr>
<td class="topAlign">
<tt>QPainter.CompositionMode_DestinationOut</tt></td>
<td class="topAlign"><tt>8</tt></td>
<td class="topAlign">The output is the destination, where the alpha
is reduced by the inverse of the source. This mode is the inverse
of CompositionMode_SourceOut.</td>
</tr>
<tr>
<td class="topAlign">
<tt>QPainter.CompositionMode_SourceAtop</tt></td>
<td class="topAlign"><tt>9</tt></td>
<td class="topAlign">The source pixel is blended on top of the
destination, with the alpha of the source pixel reduced by the
alpha of the destination pixel.</td>
</tr>
<tr>
<td class="topAlign">
<tt>QPainter.CompositionMode_DestinationAtop</tt></td>
<td class="topAlign"><tt>10</tt></td>
<td class="topAlign">The destination pixel is blended on top of the
source, with the alpha of the destination pixel is reduced by the
alpha of the destination pixel. This mode is the inverse of
CompositionMode_SourceAtop.</td>
</tr>
<tr>
<td class="topAlign"><tt>QPainter.CompositionMode_Xor</tt></td>
<td class="topAlign"><tt>11</tt></td>
<td class="topAlign">The source, whose alpha is reduced with the
inverse of the destination alpha, is merged with the destination,
whose alpha is reduced by the inverse of the source alpha.
CompositionMode_Xor is not the same as the bitwise Xor.</td>
</tr>
<tr>
<td class="topAlign"><tt>QPainter.CompositionMode_Plus</tt></td>
<td class="topAlign"><tt>12</tt></td>
<td class="topAlign">Both the alpha and color of the source and
destination pixels are added together.</td>
</tr>
<tr>
<td class="topAlign">
<tt>QPainter.CompositionMode_Multiply</tt></td>
<td class="topAlign"><tt>13</tt></td>
<td class="topAlign">The output is the source color multiplied by
the destination. Multiplying a color with white leaves the color
unchanged, while multiplying a color with black produces
black.</td>
</tr>
<tr>
<td class="topAlign"><tt>QPainter.CompositionMode_Screen</tt></td>
<td class="topAlign"><tt>14</tt></td>
<td class="topAlign">The source and destination colors are inverted
and then multiplied. Screening a color with white produces white,
whereas screening a color with black leaves the color
unchanged.</td>
</tr>
<tr>
<td class="topAlign">
<tt>QPainter.CompositionMode_Overlay</tt></td>
<td class="topAlign"><tt>15</tt></td>
<td class="topAlign">Multiplies or screens the colors depending on
the destination color. The destination color is mixed with the
source color to reflect the lightness or darkness of the
destination.</td>
</tr>
<tr>
<td class="topAlign"><tt>QPainter.CompositionMode_Darken</tt></td>
<td class="topAlign"><tt>16</tt></td>
<td class="topAlign">The darker of the source and destination
colors is selected.</td>
</tr>
<tr>
<td class="topAlign">
<tt>QPainter.CompositionMode_Lighten</tt></td>
<td class="topAlign"><tt>17</tt></td>
<td class="topAlign">The lighter of the source and destination
colors is selected.</td>
</tr>
<tr>
<td class="topAlign">
<tt>QPainter.CompositionMode_ColorDodge</tt></td>
<td class="topAlign"><tt>18</tt></td>
<td class="topAlign">The destination color is brightened to reflect
the source color. A black source color leaves the destination color
unchanged.</td>
</tr>
<tr>
<td class="topAlign">
<tt>QPainter.CompositionMode_ColorBurn</tt></td>
<td class="topAlign"><tt>19</tt></td>
<td class="topAlign">The destination color is darkened to reflect
the source color. A white source color leaves the destination color
unchanged.</td>
</tr>
<tr>
<td class="topAlign">
<tt>QPainter.CompositionMode_HardLight</tt></td>
<td class="topAlign"><tt>20</tt></td>
<td class="topAlign">Multiplies or screens the colors depending on
the source color. A light source color will lighten the destination
color, whereas a dark source color will darken the destination
color.</td>
</tr>
<tr>
<td class="topAlign">
<tt>QPainter.CompositionMode_SoftLight</tt></td>
<td class="topAlign"><tt>21</tt></td>
<td class="topAlign">Darkens or lightens the colors depending on
the source color. Similar to CompositionMode_HardLight.</td>
</tr>
<tr>
<td class="topAlign">
<tt>QPainter.CompositionMode_Difference</tt></td>
<td class="topAlign"><tt>22</tt></td>
<td class="topAlign">Subtracts the darker of the colors from the
lighter. Painting with white inverts the destination color, whereas
painting with black leaves the destination color unchanged.</td>
</tr>
<tr>
<td class="topAlign">
<tt>QPainter.CompositionMode_Exclusion</tt></td>
<td class="topAlign"><tt>23</tt></td>
<td class="topAlign">Similar to CompositionMode_Difference, but
with a lower contrast. Painting with white inverts the destination
color, whereas painting with black leaves the destination color
unchanged.</td>
</tr>
<tr>
<td class="topAlign">
<tt>QPainter.RasterOp_SourceOrDestination</tt></td>
<td class="topAlign"><tt>24</tt></td>
<td class="topAlign">Does a bitwise OR operation on the source and
destination pixels (src OR dst).</td>
</tr>
<tr>
<td class="topAlign">
<tt>QPainter.RasterOp_SourceAndDestination</tt></td>
<td class="topAlign"><tt>25</tt></td>
<td class="topAlign">Does a bitwise AND operation on the source and
destination pixels (src AND dst).</td>
</tr>
<tr>
<td class="topAlign">
<tt>QPainter.RasterOp_SourceXorDestination</tt></td>
<td class="topAlign"><tt>26</tt></td>
<td class="topAlign">Does a bitwise XOR operation on the source and
destination pixels (src XOR dst).</td>
</tr>
<tr>
<td class="topAlign">
<tt>QPainter.RasterOp_NotSourceAndNotDestination</tt></td>
<td class="topAlign"><tt>27</tt></td>
<td class="topAlign">Does a bitwise NOR operation on the source and
destination pixels ((NOT src) AND (NOT dst)).</td>
</tr>
<tr>
<td class="topAlign">
<tt>QPainter.RasterOp_NotSourceOrNotDestination</tt></td>
<td class="topAlign"><tt>28</tt></td>
<td class="topAlign">Does a bitwise NAND operation on the source
and destination pixels ((NOT src) OR (NOT dst)).</td>
</tr>
<tr>
<td class="topAlign">
<tt>QPainter.RasterOp_NotSourceXorDestination</tt></td>
<td class="topAlign"><tt>29</tt></td>
<td class="topAlign">Does a bitwise operation where the source
pixels are inverted and then XOR'ed with the destination ((NOT src)
XOR dst).</td>
</tr>
<tr>
<td class="topAlign"><tt>QPainter.RasterOp_NotSource</tt></td>
<td class="topAlign"><tt>30</tt></td>
<td class="topAlign">Does a bitwise operation where the source
pixels are inverted (NOT src).</td>
</tr>
<tr>
<td class="topAlign">
<tt>QPainter.RasterOp_NotSourceAndDestination</tt></td>
<td class="topAlign"><tt>31</tt></td>
<td class="topAlign">Does a bitwise operation where the source is
inverted and then AND'ed with the destination ((NOT src) AND
dst).</td>
</tr>
<tr>
<td class="topAlign">
<tt>QPainter.RasterOp_SourceAndNotDestination</tt></td>
<td class="topAlign"><tt>32</tt></td>
<td class="topAlign">Does a bitwise operation where the source is
AND'ed with the inverted destination pixels (src AND (NOT
dst)).</td>
</tr>
</table>
<p><b>See also</b> <a href="qpainter.html#compositionMode">compositionMode</a>(), <a href="qpainter.html#setCompositionMode">setCompositionMode</a>(),
<a href="qpainter.html#composition-modes">Composition Modes</a>,
and <a href="painting-imagecomposition.html">Image Composition
Example</a>.</p>


<h3 class="fn"><a name="PixmapFragmentHint-enum" />QPainter.PixmapFragmentHint</h3><table class="valuelist">
<tr class="odd" valign="top">
<th class="tblConst">Constant</th>
<th class="tblval">Value</th>
<th class="tbldscr">Description</th>
</tr>
<tr>
<td class="topAlign"><tt>QPainter.OpaqueHint</tt></td>
<td class="topAlign"><tt>0x01</tt></td>
<td class="topAlign">Indicates that the pixmap fragments to be
drawn are opaque. Opaque fragments are potentially faster to
draw.</td>
</tr>
</table>
<p>This enum was introduced or modified in Qt 4.7.</p>
<p>The PixmapFragmentHints type is a typedef for <a href="qflags.html">QFlags</a>&lt;PixmapFragmentHint&gt;. It stores an OR
combination of PixmapFragmentHint values.</p>
<p><b>See also</b> <a href="qpainter.html#drawPixmapFragments">QPainter.drawPixmapFragments</a>()
and <a href="qpainter-pixmapfragment.html">QPainter.PixmapFragment</a>.</p>


<h3 class="fn"><a name="RenderHint-enum" />QPainter.RenderHint</h3><p>Renderhints are used to specify flags to <a href="qpainter.html">QPainter</a> that may or may not be respected by
any given engine.</p>
<table class="valuelist">
<tr class="odd" valign="top">
<th class="tblConst">Constant</th>
<th class="tblval">Value</th>
<th class="tbldscr">Description</th>
</tr>
<tr>
<td class="topAlign"><tt>QPainter.Antialiasing</tt></td>
<td class="topAlign"><tt>0x01</tt></td>
<td class="topAlign">Indicates that the engine should antialias
edges of primitives if possible.</td>
</tr>
<tr>
<td class="topAlign"><tt>QPainter.TextAntialiasing</tt></td>
<td class="topAlign"><tt>0x02</tt></td>
<td class="topAlign">Indicates that the engine should antialias
text if possible. To forcibly disable antialiasing for text, do not
use this hint. Instead, set <a href="qfont.html#StyleStrategy-enum">QFont.NoAntialias</a> on your
font's style strategy.</td>
</tr>
<tr>
<td class="topAlign"><tt>QPainter.SmoothPixmapTransform</tt></td>
<td class="topAlign"><tt>0x04</tt></td>
<td class="topAlign">Indicates that the engine should use a smooth
pixmap transformation algorithm (such as bilinear) rather than
nearest neighbor.</td>
</tr>
<tr>
<td class="topAlign">
<tt>QPainter.HighQualityAntialiasing</tt></td>
<td class="topAlign"><tt>0x08</tt></td>
<td class="topAlign">An OpenGL-specific rendering hint indicating
that the engine should use fragment programs and offscreen
rendering for antialiasing.</td>
</tr>
<tr>
<td class="topAlign"><tt>QPainter.NonCosmeticDefaultPen</tt></td>
<td class="topAlign"><tt>0x10</tt></td>
<td class="topAlign">The engine should interpret pens with a width
of 0 (which otherwise enables <a href="qpen.html#isCosmetic">QPen.isCosmetic</a>()) as being a
non-cosmetic pen with a width of 1.</td>
</tr>
</table>
<p>The RenderHints type is a typedef for <a href="qflags.html">QFlags</a>&lt;RenderHint&gt;. It stores an OR
combination of RenderHint values.</p>
<p><b>See also</b> <a href="qpainter.html#renderHints">renderHints</a>(), <a href="qpainter.html#setRenderHint">setRenderHint</a>(), <a href="qpainter.html#rendering-quality">Rendering Quality</a>, and
<a href="painting-concentriccircles.html">Concentric Circles
Example</a>.</p>
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QPainter" />QPainter.__init__ (<i>self</i>)</h3><p>Constructs a painter.</p>
<p><b>See also</b> <a href="qpainter.html#begin">begin</a>() and
<a href="qpainter.html#end">end</a>().</p>


<h3 class="fn"><a name="QPainter-2" />QPainter.__init__ (<i>self</i>, <a href="qpaintdevice.html">QPaintDevice</a>)</h3><p>Constructs a painter that begins painting the paint
<i>device</i> immediately.</p>
<p>This constructor is convenient for short-lived painters, e.g. in
a <a href="qwidget.html#paintEvent">QWidget.paintEvent</a>() and
should be used only once. The constructor calls <a href="qpainter.html#begin">begin</a>() for you and the <a href="qpainter.html">QPainter</a> destructor automatically calls
<a href="qpainter.html#end">end</a>().</p>
<p>Here's an example using <a href="qpainter.html#begin">begin</a>() and <a href="qpainter.html#end">end</a>():</p>
<pre class="cpp">
 <span class="type">void</span> MyWidget<span class="operator">.</span>paintEvent(<span class="type"><a href="qpaintevent.html">QPaintEvent</a></span> <span class="operator">*</span>)
 {
     <span class="type"><a href="qpainter.html">QPainter</a></span> p;
     p<span class="operator">.</span>begin(<span class="keyword">this</span>);
     p<span class="operator">.</span>drawLine(<span class="operator">.</span><span class="operator">.</span><span class="operator">.</span>);        <span class="comment">// drawing code</span>
     p<span class="operator">.</span>end();
 }
</pre>
<p>The same example using this constructor:</p>
<pre class="cpp">
 <span class="type">void</span> MyWidget<span class="operator">.</span>paintEvent(<span class="type"><a href="qpaintevent.html">QPaintEvent</a></span> <span class="operator">*</span>)
 {
     <span class="type"><a href="qpainter.html">QPainter</a></span> p(<span class="keyword">this</span>);
     p<span class="operator">.</span>drawLine(<span class="operator">.</span><span class="operator">.</span><span class="operator">.</span>);        <span class="comment">// drawing code</span>
 }
</pre>
<p>Since the constructor cannot provide feedback when the
initialization of the painter failed you should rather use <a href="qpainter.html#begin">begin</a>() and <a href="qpainter.html#end">end</a>() to paint on external devices, e.g.
printers.</p>
<p><b>See also</b> <a href="qpainter.html#begin">begin</a>() and
<a href="qpainter.html#end">end</a>().</p>


<h3 class="fn"><a name="background" /><a href="qbrush.html">QBrush</a> QPainter.background (<i>self</i>)</h3><p>Returns the current background brush.</p>
<p><b>See also</b> <a href="qpainter.html#setBackground">setBackground</a>() and <a href="qpainter.html#settings">Settings</a>.</p>


<h3 class="fn"><a name="backgroundMode" /><a href="qt.html#BGMode-enum">Qt.BGMode</a> QPainter.backgroundMode (<i>self</i>)</h3><p>Returns the current background mode.</p>
<p><b>See also</b> <a href="qpainter.html#setBackgroundMode">setBackgroundMode</a>() and
<a href="qpainter.html#settings">Settings</a>.</p>


<h3 class="fn"><a name="begin" />bool QPainter.begin (<i>self</i>, <a href="qpaintdevice.html">QPaintDevice</a>)</h3><p>Begins painting the paint <i>device</i> and returns true if
successful; otherwise returns false.</p>
<p>Notice that all painter settings (<a href="qpainter.html#setPen">setPen</a>(), <a href="qpainter.html#setBrush">setBrush</a>() etc.) are reset to default
values when begin() is called.</p>
<p>The errors that can occur are serious problems, such as
these:</p>
<pre class="cpp">
 painter<span class="operator">-</span><span class="operator">&gt;</span>begin(<span class="number">0</span>); <span class="comment">// impossible - paint device cannot be 0</span>

 <span class="type"><a href="qpixmap.html">QPixmap</a></span> image(<span class="number">0</span><span class="operator">,</span> <span class="number">0</span>);
 painter<span class="operator">-</span><span class="operator">&gt;</span>begin(<span class="operator">&amp;</span>image); <span class="comment">// impossible - image.isNull() == true;</span>

 painter<span class="operator">-</span><span class="operator">&gt;</span>begin(myWidget);
 painter2<span class="operator">-</span><span class="operator">&gt;</span>begin(myWidget); <span class="comment">// impossible - only one painter at a time</span>
</pre>
<p>Note that most of the time, you can use one of the constructors
instead of begin(), and that <a href="qpainter.html#end">end</a>()
is automatically done at destruction.</p>
<p><b>Warning:</b> A paint device can only be painted by one
painter at a time.</p>
<p><b>Warning:</b> Painting on a <a href="qimage.html">QImage</a>
with the format <a href="qimage.html#Format-enum">QImage.Format_Indexed8</a> is not
supported.</p>
<p><b>See also</b> <a href="qpainter.html#end">end</a>() and
<a href="qpainter.html#QPainter">QPainter</a>().</p>


<h3 class="fn"><a name="beginNativePainting" />QPainter.beginNativePainting (<i>self</i>)</h3><p>Flushes the painting pipeline and prepares for the user issuing
commands directly to the underlying graphics context. Must be
followed by a call to <a href="qpainter.html#endNativePainting">endNativePainting</a>().</p>
<p>Note that only the states the underlying paint engine changes
will be reset to their respective default states. The states we
reset may change from release to release. The following states are
currently reset in the OpenGL 2 engine:</p>
<ul>
<li>blending is disabled</li>
<li>the depth, stencil and scissor tests are disabled</li>
<li>the active texture unit is reset to 0</li>
<li>the depth mask, depth function and the clear depth are reset to
their default values</li>
<li>the stencil mask, stencil operation and stencil function are
reset to their default values</li>
<li>the current color is reset to solid white</li>
</ul>
<p>If, for example, the OpenGL polygon mode is changed by the user
inside a beginNativePaint()/<a href="qpainter.html#endNativePainting">endNativePainting</a>() block, it
will not be reset to the default state by <a href="qpainter.html#endNativePainting">endNativePainting</a>(). Here is
an example that shows intermixing of painter commands and raw
OpenGL commands:</p>
<pre class="cpp">
 <span class="type"><a href="qpainter.html">QPainter</a></span> painter(<span class="keyword">this</span>);
 painter<span class="operator">.</span><a href="qpainter.html#fillRect">fillRect</a>(<span class="number">0</span><span class="operator">,</span> <span class="number">0</span><span class="operator">,</span> <span class="number">128</span><span class="operator">,</span> <span class="number">128</span><span class="operator">,</span> <span class="type"><a href="qt.html">Qt</a></span><span class="operator">.</span>green);
 painter<span class="operator">.</span>beginNativePainting();

 glEnable(GL_SCISSOR_TEST);
 glScissor(<span class="number">0</span><span class="operator">,</span> <span class="number">0</span><span class="operator">,</span> <span class="number">64</span><span class="operator">,</span> <span class="number">64</span>);

 glClearColor(<span class="number">1</span><span class="operator">,</span> <span class="number">0</span><span class="operator">,</span> <span class="number">0</span><span class="operator">,</span> <span class="number">1</span>);
 glClear(GL_COLOR_BUFFER_BIT);

 glDisable(GL_SCISSOR_TEST);

 painter<span class="operator">.</span><a href="qpainter.html#endNativePainting">endNativePainting</a>();
</pre>
<p>This function was introduced in Qt 4.6.</p>
<p><b>See also</b> <a href="qpainter.html#endNativePainting">endNativePainting</a>().</p>


<h3 class="fn"><a name="boundingRect" /><a href="qrectf.html">QRectF</a> QPainter.boundingRect (<i>self</i>, <a href="qrectf.html">QRectF</a>&#160;<i>rect</i>, int&#160;<i>flags</i>, QString&#160;<i>text</i>)</h3><p>Returns the bounding rectangle of the <i>text</i> as it will
appear when drawn inside the given <i>rectangle</i> with the
specified <i>flags</i> using the currently set <a href="qpainter.html#font">font</a>(); i.e the function tells you where
the <a href="qpainter.html#drawText">drawText</a>() function will
draw when given the same arguments.</p>
<p>If the <i>text</i> does not fit within the given
<i>rectangle</i> using the specified <i>flags</i>, the function
returns the required rectangle.</p>
<p>The <i>flags</i> argument is a bitwise OR of the following
flags:</p>
<ul>
<li><a href="qt.html#AlignmentFlag-enum">Qt.AlignLeft</a></li>
<li><a href="qt.html#AlignmentFlag-enum">Qt.AlignRight</a></li>
<li><a href="qt.html#AlignmentFlag-enum">Qt.AlignHCenter</a></li>
<li><a href="qt.html#AlignmentFlag-enum">Qt.AlignTop</a></li>
<li><a href="qt.html#AlignmentFlag-enum">Qt.AlignBottom</a></li>
<li><a href="qt.html#AlignmentFlag-enum">Qt.AlignVCenter</a></li>
<li><a href="qt.html#AlignmentFlag-enum">Qt.AlignCenter</a></li>
<li><a href="qt.html#TextFlag-enum">Qt.TextSingleLine</a></li>
<li><a href="qt.html#TextFlag-enum">Qt.TextExpandTabs</a></li>
<li><a href="qt.html#TextFlag-enum">Qt.TextShowMnemonic</a></li>
<li><a href="qt.html#TextFlag-enum">Qt.TextWordWrap</a></li>
<li><a href="qt.html#TextFlag-enum">Qt.TextIncludeTrailingSpaces</a></li>
</ul>
<p>If several of the horizontal or several of the vertical
alignment flags are set, the resulting alignment is undefined.</p>
<p><b>See also</b> <a href="qpainter.html#drawText">drawText</a>(),
<a href="qt.html#AlignmentFlag-enum">Qt.Alignment</a>, and
<a href="qt.html#TextFlag-enum">Qt.TextFlag</a>.</p>


<h3 class="fn"><a name="boundingRect-2" /><a href="qrect.html">QRect</a> QPainter.boundingRect (<i>self</i>, <a href="qrect.html">QRect</a>&#160;<i>rect</i>, int&#160;<i>flags</i>, QString&#160;<i>text</i>)</h3><h3 class="fn"><a name="boundingRect-3" /><a href="qrectf.html">QRectF</a> QPainter.boundingRect (<i>self</i>, <a href="qrectf.html">QRectF</a>&#160;<i>rectangle</i>, QString&#160;<i>text</i>, <a href="qtextoption.html">QTextOption</a>&#160;<i>option</i>&#160;=&#160;QTextOption())</h3><h3 class="fn"><a name="boundingRect-4" /><a href="qrect.html">QRect</a> QPainter.boundingRect (<i>self</i>, int&#160;<i>x</i>, int&#160;<i>y</i>, int&#160;<i>w</i>, int&#160;<i>h</i>, int&#160;<i>flags</i>, QString&#160;<i>text</i>)</h3><p>This is an overloaded function.</p>
<p>Returns the bounding rectangle of the <i>text</i> as it will
appear when drawn inside the given <i>rectangle</i> with the
specified <i>flags</i> using the currently set <a href="qpainter.html#font">font</a>().</p>


<h3 class="fn"><a name="brush" /><a href="qbrush.html">QBrush</a> QPainter.brush (<i>self</i>)</h3><p>Returns the painter's current brush.</p>
<p><b>See also</b> <a href="qpainter.html#setBrush">QPainter.setBrush</a>() and <a href="qpainter.html#settings">Settings</a>.</p>


<h3 class="fn"><a name="brushOrigin" /><a href="qpoint.html">QPoint</a> QPainter.brushOrigin (<i>self</i>)</h3><p>Returns the currently set brush origin.</p>
<p><b>See also</b> <a href="qpainter.html#setBrushOrigin">setBrushOrigin</a>() and <a href="qpainter.html#settings">Settings</a>.</p>


<h3 class="fn"><a name="clipPath" /><a href="qpainterpath.html">QPainterPath</a> QPainter.clipPath (<i>self</i>)</h3><p>Returns the currently clip as a path. Note that the clip path is
given in logical coordinates.</p>
<p><b>Warning:</b> <a href="qpainter.html">QPainter</a> does not
store the combined clip explicitly as this is handled by the
underlying <a href="qpaintengine.html">QPaintEngine</a>, so the
path is recreated on demand and transformed to the current logical
coordinate system. This is potentially an expensive operation.</p>
<p><b>See also</b> <a href="qpainter.html#setClipPath">setClipPath</a>(), <a href="qpainter.html#clipRegion">clipRegion</a>(), and <a href="qpainter.html#setClipping">setClipping</a>().</p>


<h3 class="fn"><a name="clipRegion" /><a href="qregion.html">QRegion</a> QPainter.clipRegion (<i>self</i>)</h3><p>Returns the currently set clip region. Note that the clip region
is given in logical coordinates.</p>
<p><b>Warning:</b> <a href="qpainter.html">QPainter</a> does not
store the combined clip explicitly as this is handled by the
underlying <a href="qpaintengine.html">QPaintEngine</a>, so the
path is recreated on demand and transformed to the current logical
coordinate system. This is potentially an expensive operation.</p>
<p><b>See also</b> <a href="qpainter.html#setClipRegion">setClipRegion</a>(), <a href="qpainter.html#clipPath">clipPath</a>(), and <a href="qpainter.html#setClipping">setClipping</a>().</p>


<h3 class="fn"><a name="combinedMatrix" /><a href="qmatrix.html">QMatrix</a> QPainter.combinedMatrix (<i>self</i>)</h3><h3 class="fn"><a name="combinedTransform" /><a href="qtransform.html">QTransform</a> QPainter.combinedTransform (<i>self</i>)</h3><p>Returns the transformation matrix combining the current
window/viewport and world transformation.</p>
<p><b>See also</b> <a href="qpainter.html#setWorldTransform">setWorldTransform</a>(), <a href="qpainter.html#setWindow">setWindow</a>(), and <a href="qpainter.html#setViewport">setViewport</a>().</p>


<h3 class="fn"><a name="compositionMode" /><a href="qpainter.html#CompositionMode-enum">CompositionMode</a> QPainter.compositionMode (<i>self</i>)</h3><p>Returns the current composition mode.</p>
<p><b>See also</b> <a href="qpainter.html#CompositionMode-enum">CompositionMode</a> and
<a href="qpainter.html#setCompositionMode">setCompositionMode</a>().</p>


<h3 class="fn"><a name="device" /><a href="qpaintdevice.html">QPaintDevice</a> QPainter.device (<i>self</i>)</h3><p>Returns the paint device on which this painter is currently
painting, or 0 if the painter is not active.</p>
<p><b>See also</b> <a href="qpainter.html#isActive">isActive</a>().</p>


<h3 class="fn"><a name="deviceMatrix" /><a href="qmatrix.html">QMatrix</a> QPainter.deviceMatrix (<i>self</i>)</h3><h3 class="fn"><a name="deviceTransform" /><a href="qtransform.html">QTransform</a> QPainter.deviceTransform (<i>self</i>)</h3><p>Returns the matrix that transforms from logical coordinates to
device coordinates of the platform dependent paint device.</p>
<p>This function is <i>only</i> needed when using platform painting
commands on the platform dependent handle (<a href="qt.html#HANDLE-typedef">Qt.HANDLE</a>), and the platform does not
do transformations nativly.</p>
<p>The <a href="qpaintengine.html#PaintEngineFeature-enum">QPaintEngine.PaintEngineFeature</a>
enum can be queried to determine whether the platform performs the
transformations or not.</p>
<p><b>See also</b> <a href="qpainter.html#worldTransform">worldTransform</a>() and <a href="qpaintengine.html#hasFeature">QPaintEngine.hasFeature</a>().</p>


<h3 class="fn"><a name="drawArc" />QPainter.drawArc (<i>self</i>, <a href="qrectf.html">QRectF</a>&#160;<i>rect</i>, int&#160;<i>a</i>, int&#160;<i>alen</i>)</h3><p>Draws the arc defined by the given <i>rectangle</i>,
<i>startAngle</i> and <i>spanAngle</i>.</p>
<p>The <i>startAngle</i> and <i>spanAngle</i> must be specified in
1/16th of a degree, i.e. a full circle equals 5760 (16 * 360).
Positive values for the angles mean counter-clockwise while
negative values mean the clockwise direction. Zero degrees is at
the 3 o'clock position.</p>
<table class="generic" width="100%">
<tr class="odd" valign="top">
<td><img src="images/qpainter-arc.png" /></td>
<td>
<pre class="cpp">
 <span class="type"><a href="qrectf.html">QRectF</a></span> rectangle(<span class="number">10.0</span><span class="operator">,</span> <span class="number">20.0</span><span class="operator">,</span> <span class="number">80.0</span><span class="operator">,</span> <span class="number">60.0</span>);
 <span class="type">int</span> startAngle <span class="operator">=</span> <span class="number">30</span> <span class="operator">*</span> <span class="number">16</span>;
 <span class="type">int</span> spanAngle <span class="operator">=</span> <span class="number">120</span> <span class="operator">*</span> <span class="number">16</span>;

 <span class="type"><a href="qpainter.html">QPainter</a></span> painter(<span class="keyword">this</span>);
 painter<span class="operator">.</span>drawArc(rectangle<span class="operator">,</span> startAngle<span class="operator">,</span> spanAngle);
</pre></td>
</tr>
</table>
<p><b>See also</b> <a href="qpainter.html#drawPie">drawPie</a>(),
<a href="qpainter.html#drawChord">drawChord</a>(), and <a href="coordsys.html">Coordinate System</a>.</p>


<h3 class="fn"><a name="drawArc-2" />QPainter.drawArc (<i>self</i>, <a href="qrect.html">QRect</a>&#160;<i>r</i>, int&#160;<i>a</i>, int&#160;<i>alen</i>)</h3><p>This is an overloaded function.</p>
<p>Draws the arc defined by the given <i>rectangle</i>,
<i>startAngle</i> and <i>spanAngle</i>.</p>


<h3 class="fn"><a name="drawArc-3" />QPainter.drawArc (<i>self</i>, int&#160;<i>x</i>, int&#160;<i>y</i>, int&#160;<i>w</i>, int&#160;<i>h</i>, int&#160;<i>a</i>, int&#160;<i>alen</i>)</h3><p>This is an overloaded function.</p>
<p>Draws the arc defined by the rectangle beginning at (<i>x</i>,
<i>y</i>) with the specified <i>width</i> and <i>height</i>, and
the given <i>startAngle</i> and <i>spanAngle</i>.</p>


<h3 class="fn"><a name="drawChord" />QPainter.drawChord (<i>self</i>, <a href="qrectf.html">QRectF</a>&#160;<i>rect</i>, int&#160;<i>a</i>, int&#160;<i>alen</i>)</h3><p>Draws the chord defined by the given <i>rectangle</i>,
<i>startAngle</i> and <i>spanAngle</i>. The chord is filled with
the current <a href="qpainter.html#brush">brush</a>().</p>
<p>The startAngle and spanAngle must be specified in 1/16th of a
degree, i.e. a full circle equals 5760 (16 * 360). Positive values
for the angles mean counter-clockwise while negative values mean
the clockwise direction. Zero degrees is at the 3 o'clock
position.</p>
<table class="generic" width="100%">
<tr class="odd" valign="top">
<td><img src="images/qpainter-chord.png" /></td>
<td>
<pre class="cpp">
 <span class="type"><a href="qrectf.html">QRectF</a></span> rectangle(<span class="number">10.0</span><span class="operator">,</span> <span class="number">20.0</span><span class="operator">,</span> <span class="number">80.0</span><span class="operator">,</span> <span class="number">60.0</span>);
 <span class="type">int</span> startAngle <span class="operator">=</span> <span class="number">30</span> <span class="operator">*</span> <span class="number">16</span>;
 <span class="type">int</span> spanAngle <span class="operator">=</span> <span class="number">120</span> <span class="operator">*</span> <span class="number">16</span>;

 <span class="type"><a href="qpainter.html">QPainter</a></span> painter(<span class="keyword">this</span>);
 painter<span class="operator">.</span>drawChord(rect<span class="operator">,</span> startAngle<span class="operator">,</span> spanAngle);
</pre></td>
</tr>
</table>
<p><b>See also</b> <a href="qpainter.html#drawArc">drawArc</a>(),
<a href="qpainter.html#drawPie">drawPie</a>(), and <a href="coordsys.html">Coordinate System</a>.</p>


<h3 class="fn"><a name="drawChord-2" />QPainter.drawChord (<i>self</i>, <a href="qrect.html">QRect</a>&#160;<i>rect</i>, int&#160;<i>a</i>, int&#160;<i>alen</i>)</h3><p>This is an overloaded function.</p>
<p>Draws the chord defined by the given <i>rectangle</i>,
<i>startAngle</i> and <i>spanAngle</i>.</p>


<h3 class="fn"><a name="drawChord-3" />QPainter.drawChord (<i>self</i>, int&#160;<i>x</i>, int&#160;<i>y</i>, int&#160;<i>w</i>, int&#160;<i>h</i>, int&#160;<i>a</i>, int&#160;<i>alen</i>)</h3><p>This is an overloaded function.</p>
<p>Draws the chord defined by the rectangle beginning at (<i>x</i>,
<i>y</i>) with the specified <i>width</i> and <i>height</i>, and
the given <i>startAngle</i> and <i>spanAngle</i>.</p>


<h3 class="fn"><a name="drawConvexPolygon" />QPainter.drawConvexPolygon (<i>self</i>, <a href="qpointf.html">QPointF</a>&#160;<i>point</i>, ...)</h3><p>Draws the convex polygon defined by the first <i>pointCount</i>
points in the array <i>points</i> using the current pen.</p>
<table class="generic" width="100%">
<tr class="odd" valign="top">
<td><img src="images/qpainter-polygon.png" /></td>
<td>
<pre class="cpp">
 <span class="keyword">static</span> <span class="keyword">const</span> <span class="type"><a href="qpointf.html">QPointF</a></span> points<span class="operator">[</span><span class="number">4</span><span class="operator">]</span> <span class="operator">=</span> {
     <span class="type"><a href="qpointf.html">QPointF</a></span>(<span class="number">10.0</span><span class="operator">,</span> <span class="number">80.0</span>)<span class="operator">,</span>
     <span class="type"><a href="qpointf.html">QPointF</a></span>(<span class="number">20.0</span><span class="operator">,</span> <span class="number">10.0</span>)<span class="operator">,</span>
     <span class="type"><a href="qpointf.html">QPointF</a></span>(<span class="number">80.0</span><span class="operator">,</span> <span class="number">30.0</span>)<span class="operator">,</span>
     <span class="type"><a href="qpointf.html">QPointF</a></span>(<span class="number">90.0</span><span class="operator">,</span> <span class="number">70.0</span>)
 };

 <span class="type"><a href="qpainter.html">QPainter</a></span> painter(<span class="keyword">this</span>);
 painter<span class="operator">.</span>drawConvexPolygon(points<span class="operator">,</span> <span class="number">4</span>);
</pre></td>
</tr>
</table>
<p>The first point is implicitly connected to the last point, and
the polygon is filled with the current <a href="qpainter.html#brush">brush</a>(). If the supplied polygon is not
convex, i.e. it contains at least one angle larger than 180
degrees, the results are undefined.</p>
<p>On some platforms (e.g. X11), the drawConvexPolygon() function
can be faster than the <a href="qpainter.html#drawPolygon">drawPolygon</a>() function.</p>
<p><b>See also</b> <a href="qpainter.html#drawPolygon">drawPolygon</a>(), <a href="qpainter.html#drawPolyline">drawPolyline</a>(), and <a href="coordsys.html">Coordinate System</a>.</p>


<h3 class="fn"><a name="drawConvexPolygon-2" />QPainter.drawConvexPolygon (<i>self</i>, <a href="qpolygonf.html">QPolygonF</a>&#160;<i>poly</i>)</h3><p>This is an overloaded function.</p>
<p>Draws the convex polygon defined by the first <i>pointCount</i>
points in the array <i>points</i> using the current pen.</p>


<h3 class="fn"><a name="drawConvexPolygon-3" />QPainter.drawConvexPolygon (<i>self</i>, <a href="qpoint.html">QPoint</a>&#160;<i>point</i>, ...)</h3><p>This is an overloaded function.</p>
<p>Draws the convex polygon defined by <i>polygon</i> using the
current pen and brush.</p>


<h3 class="fn"><a name="drawConvexPolygon-4" />QPainter.drawConvexPolygon (<i>self</i>, <a href="qpolygon.html">QPolygon</a>&#160;<i>poly</i>)</h3><p>This is an overloaded function.</p>
<p>Draws the convex polygon defined by <i>polygon</i> using the
current pen and brush.</p>


<h3 class="fn"><a name="drawEllipse" />QPainter.drawEllipse (<i>self</i>, <a href="qrectf.html">QRectF</a>&#160;<i>r</i>)</h3><p>Draws the ellipse defined by the given <i>rectangle</i>.</p>
<p>A filled ellipse has a size of <i>rectangle</i>.<a href="qrect.html#size">size()</a>. A stroked ellipse has a size of
<i>rectangle</i>.<a href="qrect.html#size">size()</a> plus the pen
width.</p>
<table class="generic" width="100%">
<tr class="odd" valign="top">
<td><img src="images/qpainter-ellipse.png" /></td>
<td>
<pre class="cpp">
 <span class="type"><a href="qrectf.html">QRectF</a></span> rectangle(<span class="number">10.0</span><span class="operator">,</span> <span class="number">20.0</span><span class="operator">,</span> <span class="number">80.0</span><span class="operator">,</span> <span class="number">60.0</span>);

 <span class="type"><a href="qpainter.html">QPainter</a></span> painter(<span class="keyword">this</span>);
 painter<span class="operator">.</span>drawEllipse(rectangle);
</pre></td>
</tr>
</table>
<p><b>See also</b> <a href="qpainter.html#drawPie">drawPie</a>()
and <a href="coordsys.html">Coordinate System</a>.</p>


<h3 class="fn"><a name="drawEllipse-2" />QPainter.drawEllipse (<i>self</i>, <a href="qrect.html">QRect</a>&#160;<i>r</i>)</h3><p>This is an overloaded function.</p>
<p>Draws the ellipse defined by the given <i>rectangle</i>.</p>


<h3 class="fn"><a name="drawEllipse-3" />QPainter.drawEllipse (<i>self</i>, int&#160;<i>x</i>, int&#160;<i>y</i>, int&#160;<i>w</i>, int&#160;<i>h</i>)</h3><p>This is an overloaded function.</p>
<p>Draws the ellipse defined by the rectangle beginning at
(<i>x</i>, <i>y</i>) with the given <i>width</i> and
<i>height</i>.</p>


<h3 class="fn"><a name="drawEllipse-4" />QPainter.drawEllipse (<i>self</i>, <a href="qpointf.html">QPointF</a>&#160;<i>center</i>, float&#160;<i>rx</i>, float&#160;<i>ry</i>)</h3><p>This is an overloaded function.</p>
<p>Draws the ellipse positioned at <i>center</i> with radii
<i>rx</i> and <i>ry</i>.</p>
<p>This function was introduced in Qt 4.4.</p>


<h3 class="fn"><a name="drawEllipse-5" />QPainter.drawEllipse (<i>self</i>, <a href="qpoint.html">QPoint</a>&#160;<i>center</i>, int&#160;<i>rx</i>, int&#160;<i>ry</i>)</h3><p>This is an overloaded function.</p>
<p>Draws the ellipse positioned at <i>center</i> with radii
<i>rx</i> and <i>ry</i>.</p>
<p>This function was introduced in Qt 4.4.</p>


<h3 class="fn"><a name="drawImage" />QPainter.drawImage (<i>self</i>, <a href="qrectf.html">QRectF</a>&#160;<i>targetRect</i>, <a href="qimage.html">QImage</a>&#160;<i>image</i>, <a href="qrectf.html">QRectF</a>&#160;<i>sourceRect</i>, <a href="qt-imageconversionflags.html">Qt.ImageConversionFlags</a>&#160;<i>flags</i>&#160;=&#160;Qt.AutoColor)</h3><p>Draws the rectangular portion <i>source</i> of the given
<i>image</i> into the <i>target</i> rectangle in the paint
device.</p>
<p><b>Note:</b> The image is scaled to fit the rectangle, if both
the image and rectangle size disagree.</p>
<p>If the image needs to be modified to fit in a lower-resolution
result (e.g. converting from 32-bit to 8-bit), use the <i>flags</i>
to specify how you would prefer this to happen.</p>
<table class="generic" width="100%">
<tr class="odd" valign="top">
<td>
<pre class="cpp">
 <span class="type"><a href="qrectf.html">QRectF</a></span> target(<span class="number">10.0</span><span class="operator">,</span> <span class="number">20.0</span><span class="operator">,</span> <span class="number">80.0</span><span class="operator">,</span> <span class="number">60.0</span>);
 <span class="type"><a href="qrectf.html">QRectF</a></span> source(<span class="number">0.0</span><span class="operator">,</span> <span class="number">0.0</span><span class="operator">,</span> <span class="number">70.0</span><span class="operator">,</span> <span class="number">40.0</span>);
 <span class="type"><a href="qimage.html">QImage</a></span> image(<span class="string">":/images/myImage.png"</span>);

 <span class="type"><a href="qpainter.html">QPainter</a></span> painter(<span class="keyword">this</span>);
 painter<span class="operator">.</span>drawImage(target<span class="operator">,</span> image<span class="operator">,</span> source);
</pre></td>
</tr>
</table>
<p><b>See also</b> <a href="qpainter.html#drawPixmap">drawPixmap</a>().</p>


<h3 class="fn"><a name="drawImage-2" />QPainter.drawImage (<i>self</i>, <a href="qrect.html">QRect</a>&#160;<i>targetRect</i>, <a href="qimage.html">QImage</a>&#160;<i>image</i>, <a href="qrect.html">QRect</a>&#160;<i>sourceRect</i>, <a href="qt-imageconversionflags.html">Qt.ImageConversionFlags</a>&#160;<i>flags</i>&#160;=&#160;Qt.AutoColor)</h3><p>This is an overloaded function.</p>
<p>Draws the rectangular portion <i>source</i> of the given
<i>image</i> into the <i>target</i> rectangle in the paint
device.</p>
<p><b>Note:</b> The image is scaled to fit the rectangle, if both
the image and rectangle size disagree.</p>


<h3 class="fn"><a name="drawImage-3" />QPainter.drawImage (<i>self</i>, <a href="qpointf.html">QPointF</a>&#160;<i>p</i>, <a href="qimage.html">QImage</a>&#160;<i>image</i>, <a href="qrectf.html">QRectF</a>&#160;<i>sr</i>, <a href="qt-imageconversionflags.html">Qt.ImageConversionFlags</a>&#160;<i>flags</i>&#160;=&#160;Qt.AutoColor)</h3><p>This is an overloaded function.</p>
<p>Draws the given <i>image</i> at the given <i>point</i>.</p>


<h3 class="fn"><a name="drawImage-4" />QPainter.drawImage (<i>self</i>, <a href="qpoint.html">QPoint</a>&#160;<i>p</i>, <a href="qimage.html">QImage</a>&#160;<i>image</i>, <a href="qrect.html">QRect</a>&#160;<i>sr</i>, <a href="qt-imageconversionflags.html">Qt.ImageConversionFlags</a>&#160;<i>flags</i>&#160;=&#160;Qt.AutoColor)</h3><p>This is an overloaded function.</p>
<p>Draws the given <i>image</i> at the given <i>point</i>.</p>


<h3 class="fn"><a name="drawImage-5" />QPainter.drawImage (<i>self</i>, <a href="qrectf.html">QRectF</a>&#160;<i>r</i>, <a href="qimage.html">QImage</a>&#160;<i>image</i>)</h3><p>This is an overloaded function.</p>
<p>Draws the rectangular portion <i>source</i> of the given
<i>image</i> with its origin at the given <i>point</i>.</p>


<h3 class="fn"><a name="drawImage-6" />QPainter.drawImage (<i>self</i>, <a href="qrect.html">QRect</a>&#160;<i>r</i>, <a href="qimage.html">QImage</a>&#160;<i>image</i>)</h3><p>This is an overloaded function.</p>
<p>Draws the rectangular portion <i>source</i> of the given
<i>image</i> with its origin at the given <i>point</i>.</p>


<h3 class="fn"><a name="drawImage-7" />QPainter.drawImage (<i>self</i>, <a href="qpointf.html">QPointF</a>&#160;<i>p</i>, <a href="qimage.html">QImage</a>&#160;<i>image</i>)</h3><p>This is an overloaded function.</p>
<p>Draws the given <i>image</i> into the given
<i>rectangle</i>.</p>
<p><b>Note:</b> The image is scaled to fit the rectangle, if both
the image and rectangle size disagree.</p>


<h3 class="fn"><a name="drawImage-8" />QPainter.drawImage (<i>self</i>, <a href="qpoint.html">QPoint</a>&#160;<i>p</i>, <a href="qimage.html">QImage</a>&#160;<i>image</i>)</h3><p>This is an overloaded function.</p>
<p>Draws the given <i>image</i> into the given
<i>rectangle</i>.</p>
<p><b>Note:</b> The image is scaled to fit the rectangle, if both
the image and rectangle size disagree.</p>


<h3 class="fn"><a name="drawImage-9" />QPainter.drawImage (<i>self</i>, int&#160;<i>x</i>, int&#160;<i>y</i>, <a href="qimage.html">QImage</a>&#160;<i>image</i>, int&#160;<i>sx</i>&#160;=&#160;0, int&#160;<i>sy</i>&#160;=&#160;0, int&#160;<i>sw</i>&#160;=&#160;-1, int&#160;<i>sh</i>&#160;=&#160;-1, <a href="qt-imageconversionflags.html">Qt.ImageConversionFlags</a>&#160;<i>flags</i>&#160;=&#160;Qt.AutoColor)</h3><p>This is an overloaded function.</p>
<p>Draws an image at (<i>x</i>, <i>y</i>) by copying a part of
<i>image</i> into the paint device.</p>
<p>(<i>x</i>, <i>y</i>) specifies the top-left point in the paint
device that is to be drawn onto. (<i>sx</i>, <i>sy</i>) specifies
the top-left point in <i>image</i> that is to be drawn. The default
is (0, 0).</p>
<p>(<i>sw</i>, <i>sh</i>) specifies the size of the image that is
to be drawn. The default, (0, 0) (and negative) means all the way
to the bottom-right of the image.</p>


<h3 class="fn"><a name="drawLine" />QPainter.drawLine (<i>self</i>, <a href="qlinef.html">QLineF</a>&#160;<i>l</i>)</h3><p>Draws a line defined by <i>line</i>.</p>
<table class="generic" width="100%">
<tr class="odd" valign="top">
<td><img src="images/qpainter-line.png" /></td>
<td>
<pre class="cpp">
 <span class="type"><a href="qlinef.html">QLineF</a></span> line(<span class="number">10.0</span><span class="operator">,</span> <span class="number">80.0</span><span class="operator">,</span> <span class="number">90.0</span><span class="operator">,</span> <span class="number">20.0</span>);

 <span class="type"><a href="qpainter.html">QPainter</a></span>(<span class="keyword">this</span>);
 painter<span class="operator">.</span>drawLine(line);
</pre></td>
</tr>
</table>
<p><b>See also</b> <a href="qpainter.html#drawLines">drawLines</a>(), <a href="qpainter.html#drawPolyline">drawPolyline</a>(), and <a href="coordsys.html">Coordinate System</a>.</p>


<h3 class="fn"><a name="drawLine-2" />QPainter.drawLine (<i>self</i>, <a href="qline.html">QLine</a>&#160;<i>line</i>)</h3><p>This is an overloaded function.</p>
<p>Draws a line defined by <i>line</i>.</p>


<h3 class="fn"><a name="drawLine-3" />QPainter.drawLine (<i>self</i>, int&#160;<i>x1</i>, int&#160;<i>y1</i>, int&#160;<i>x2</i>, int&#160;<i>y2</i>)</h3><p>This is an overloaded function.</p>
<p>Draws a line from <i>p1</i> to <i>p2</i>.</p>


<h3 class="fn"><a name="drawLine-4" />QPainter.drawLine (<i>self</i>, <a href="qpoint.html">QPoint</a>&#160;<i>p1</i>, <a href="qpoint.html">QPoint</a>&#160;<i>p2</i>)</h3><p>This is an overloaded function.</p>
<p>Draws a line from <i>p1</i> to <i>p2</i>.</p>


<h3 class="fn"><a name="drawLine-5" />QPainter.drawLine (<i>self</i>, <a href="qpointf.html">QPointF</a>&#160;<i>p1</i>, <a href="qpointf.html">QPointF</a>&#160;<i>p2</i>)</h3><p>This is an overloaded function.</p>
<p>Draws a line from (<i>x1</i>, <i>y1</i>) to (<i>x2</i>,
<i>y2</i>) and sets the current pen position to (<i>x2</i>,
<i>y2</i>).</p>


<h3 class="fn"><a name="drawLines" />QPainter.drawLines (<i>self</i>, <a href="qlinef.html">QLineF</a>&#160;<i>line</i>, ...)</h3><p>Draws the first <i>lineCount</i> lines in the array <i>lines</i>
using the current pen.</p>
<p><b>See also</b> <a href="qpainter.html#drawLine">drawLine</a>()
and <a href="qpainter.html#drawPolyline">drawPolyline</a>().</p>


<h3 class="fn"><a name="drawLines-2" />QPainter.drawLines (<i>self</i>, list-of-QLineF&#160;<i>lines</i>)</h3><p>This is an overloaded function.</p>
<p>Draws the first <i>lineCount</i> lines in the array <i>lines</i>
using the current pen.</p>


<h3 class="fn"><a name="drawLines-3" />QPainter.drawLines (<i>self</i>, <a href="qpointf.html">QPointF</a>&#160;<i>pointPair</i>, ...)</h3><p>This is an overloaded function.</p>
<p>Draws the first <i>lineCount</i> lines in the array
<i>pointPairs</i> using the current pen. The lines are specified as
pairs of points so the number of entries in <i>pointPairs</i> must
be at least <i>lineCount</i> * 2.</p>


<h3 class="fn"><a name="drawLines-4" />QPainter.drawLines (<i>self</i>, list-of-QPointF&#160;<i>pointPairs</i>)</h3><p>This is an overloaded function.</p>
<p>Draws the first <i>lineCount</i> lines in the array
<i>pointPairs</i> using the current pen.</p>


<h3 class="fn"><a name="drawLines-5" />QPainter.drawLines (<i>self</i>, <a href="qline.html">QLine</a>&#160;<i>line</i>, ...)</h3><p>This is an overloaded function.</p>
<p>Draws a line for each pair of points in the vector
<i>pointPairs</i> using the current pen. If there is an odd number
of points in the array, the last point will be ignored.</p>


<h3 class="fn"><a name="drawLines-6" />QPainter.drawLines (<i>self</i>, list-of-QLine&#160;<i>lines</i>)</h3><p>This is an overloaded function.</p>
<p>Draws a line for each pair of points in the vector
<i>pointPairs</i> using the current pen.</p>


<h3 class="fn"><a name="drawLines-7" />QPainter.drawLines (<i>self</i>, <a href="qpoint.html">QPoint</a>&#160;<i>pointPair</i>, ...)</h3><p>This is an overloaded function.</p>
<p>Draws the set of lines defined by the list <i>lines</i> using
the current pen and brush.</p>


<h3 class="fn"><a name="drawLines-8" />QPainter.drawLines (<i>self</i>, list-of-QPoint&#160;<i>pointPairs</i>)</h3><p>This is an overloaded function.</p>
<p>Draws the set of lines defined by the list <i>lines</i> using
the current pen and brush.</p>


<h3 class="fn"><a name="drawPath" />QPainter.drawPath (<i>self</i>, <a href="qpainterpath.html">QPainterPath</a>&#160;<i>path</i>)</h3><p>Draws the given painter <i>path</i> using the current pen for
outline and the current brush for filling.</p>
<table class="generic" width="100%">
<tr class="odd" valign="top">
<td><img src="images/qpainter-path.png" /></td>
<td>
<pre class="cpp">
 <span class="type"><a href="qpainterpath.html">QPainterPath</a></span> path;
 path<span class="operator">.</span>moveTo(<span class="number">20</span><span class="operator">,</span> <span class="number">80</span>);
 path<span class="operator">.</span>lineTo(<span class="number">20</span><span class="operator">,</span> <span class="number">30</span>);
 path<span class="operator">.</span>cubicTo(<span class="number">80</span><span class="operator">,</span> <span class="number">0</span><span class="operator">,</span> <span class="number">50</span><span class="operator">,</span> <span class="number">50</span><span class="operator">,</span> <span class="number">80</span><span class="operator">,</span> <span class="number">80</span>);

 <span class="type"><a href="qpainter.html">QPainter</a></span> painter(<span class="keyword">this</span>);
 painter<span class="operator">.</span>drawPath(path);
</pre></td>
</tr>
</table>
<p><b>See also</b> <a href="painting-painterpaths.html">the Painter
Paths example</a> and <a href="demos-deform.html">the Vector
Deformation demo</a>.</p>


<h3 class="fn"><a name="drawPicture" />QPainter.drawPicture (<i>self</i>, <a href="qpointf.html">QPointF</a>&#160;<i>p</i>, <a href="qpicture.html">QPicture</a>&#160;<i>picture</i>)</h3><p>Replays the given <i>picture</i> at the given <i>point</i>.</p>
<p>The <a href="qpicture.html">QPicture</a> class is a paint device
that records and replays <a href="qpainter.html">QPainter</a>
commands. A picture serializes the painter commands to an IO device
in a platform-independent format. Everything that can be painted on
a widget or pixmap can also be stored in a picture.</p>
<p>This function does exactly the same as <a href="qpicture.html#play">QPicture.play</a>() when called with
<i>point</i> = <a href="qpoint.html">QPoint</a>(0, 0).</p>
<table class="generic" width="100%">
<tr class="odd" valign="top">
<td>
<pre class="cpp">
 <span class="type"><a href="qpicture.html">QPicture</a></span> picture;
 <span class="type"><a href="qpointf.html">QPointF</a></span> point(<span class="number">10.0</span><span class="operator">,</span> <span class="number">20.0</span>)
 picture<span class="operator">.</span>load(<span class="string">"drawing.pic"</span>);

 <span class="type"><a href="qpainter.html">QPainter</a></span> painter(<span class="keyword">this</span>);
 painter<span class="operator">.</span>drawPicture(<span class="number">0</span><span class="operator">,</span> <span class="number">0</span><span class="operator">,</span> picture);
</pre></td>
</tr>
</table>
<p><b>See also</b> <a href="qpicture.html#play">QPicture.play</a>().</p>


<h3 class="fn"><a name="drawPicture-2" />QPainter.drawPicture (<i>self</i>, int&#160;<i>x</i>, int&#160;<i>y</i>, <a href="qpicture.html">QPicture</a>&#160;<i>p</i>)</h3><p>This is an overloaded function.</p>
<p>Replays the given <i>picture</i> at the given <i>point</i>.</p>


<h3 class="fn"><a name="drawPicture-3" />QPainter.drawPicture (<i>self</i>, <a href="qpoint.html">QPoint</a>&#160;<i>pt</i>, <a href="qpicture.html">QPicture</a>&#160;<i>p</i>)</h3><p>This is an overloaded function.</p>
<p>Draws the given <i>picture</i> at point (<i>x</i>,
<i>y</i>).</p>


<h3 class="fn"><a name="drawPie" />QPainter.drawPie (<i>self</i>, <a href="qrectf.html">QRectF</a>&#160;<i>rect</i>, int&#160;<i>a</i>, int&#160;<i>alen</i>)</h3><p>Draws a pie defined by the given <i>rectangle</i>,
<i>startAngle</i> and and <i>spanAngle</i>.</p>
<p>The pie is filled with the current <a href="qpainter.html#brush">brush</a>().</p>
<p>The startAngle and spanAngle must be specified in 1/16th of a
degree, i.e. a full circle equals 5760 (16 * 360). Positive values
for the angles mean counter-clockwise while negative values mean
the clockwise direction. Zero degrees is at the 3 o'clock
position.</p>
<table class="generic" width="100%">
<tr class="odd" valign="top">
<td><img src="images/qpainter-pie.png" /></td>
<td>
<pre class="cpp">
 <span class="type"><a href="qrectf.html">QRectF</a></span> rectangle(<span class="number">10.0</span><span class="operator">,</span> <span class="number">20.0</span><span class="operator">,</span> <span class="number">80.0</span><span class="operator">,</span> <span class="number">60.0</span>);
 <span class="type">int</span> startAngle <span class="operator">=</span> <span class="number">30</span> <span class="operator">*</span> <span class="number">16</span>;
 <span class="type">int</span> spanAngle <span class="operator">=</span> <span class="number">120</span> <span class="operator">*</span> <span class="number">16</span>;

 <span class="type"><a href="qpainter.html">QPainter</a></span> painter(<span class="keyword">this</span>);
 painter<span class="operator">.</span>drawPie(rectangle<span class="operator">,</span> startAngle<span class="operator">,</span> spanAngle);
</pre></td>
</tr>
</table>
<p><b>See also</b> <a href="qpainter.html#drawEllipse">drawEllipse</a>(), <a href="qpainter.html#drawChord">drawChord</a>(), and <a href="coordsys.html">Coordinate System</a>.</p>


<h3 class="fn"><a name="drawPie-2" />QPainter.drawPie (<i>self</i>, <a href="qrect.html">QRect</a>&#160;<i>rect</i>, int&#160;<i>a</i>, int&#160;<i>alen</i>)</h3><p>This is an overloaded function.</p>
<p>Draws a pie defined by the given <i>rectangle</i>,
<i>startAngle</i> and and <i>spanAngle</i>.</p>


<h3 class="fn"><a name="drawPie-3" />QPainter.drawPie (<i>self</i>, int&#160;<i>x</i>, int&#160;<i>y</i>, int&#160;<i>w</i>, int&#160;<i>h</i>, int&#160;<i>a</i>, int&#160;<i>alen</i>)</h3><p>This is an overloaded function.</p>
<p>Draws the pie defined by the rectangle beginning at (<i>x</i>,
<i>y</i>) with the specified <i>width</i> and <i>height</i>, and
the given <i>startAngle</i> and <i>spanAngle</i>.</p>


<h3 class="fn"><a name="drawPixmap" />QPainter.drawPixmap (<i>self</i>, <a href="qrectf.html">QRectF</a>&#160;<i>targetRect</i>, <a href="qpixmap.html">QPixmap</a>&#160;<i>pixmap</i>, <a href="qrectf.html">QRectF</a>&#160;<i>sourceRect</i>)</h3><p>Draws the rectangular portion <i>source</i> of the given
<i>pixmap</i> into the given <i>target</i> in the paint device.</p>
<p><b>Note:</b> The pixmap is scaled to fit the rectangle, if both
the pixmap and rectangle size disagree.</p>
<table class="generic" width="100%">
<tr class="odd" valign="top">
<td>
<pre class="cpp">
 <span class="type"><a href="qrectf.html">QRectF</a></span> target(<span class="number">10.0</span><span class="operator">,</span> <span class="number">20.0</span><span class="operator">,</span> <span class="number">80.0</span><span class="operator">,</span> <span class="number">60.0</span>);
 <span class="type"><a href="qrectf.html">QRectF</a></span> source(<span class="number">0.0</span><span class="operator">,</span> <span class="number">0.0</span><span class="operator">,</span> <span class="number">70.0</span><span class="operator">,</span> <span class="number">40.0</span>);
 <span class="type"><a href="qpixmap.html">QPixmap</a></span> pixmap(<span class="string">":myPixmap.png"</span>);

 <span class="type"><a href="qpainter.html">QPainter</a></span>(<span class="keyword">this</span>);
 painter<span class="operator">.</span>drawPixmap(target<span class="operator">,</span> image<span class="operator">,</span> source);
</pre></td>
</tr>
</table>
<p>If <i>pixmap</i> is a <a href="qbitmap.html">QBitmap</a> it is
drawn with the bits that are "set" using the pens color. If
backgroundMode is <a href="qt.html#BGMode-enum">Qt.OpaqueMode</a>,
the "unset" bits are drawn using the color of the background brush;
if backgroundMode is <a href="qt.html#BGMode-enum">Qt.TransparentMode</a>, the "unset" bits are
transparent. Drawing bitmaps with gradient or texture colors is not
supported.</p>
<p><b>See also</b> <a href="qpainter.html#drawImage">drawImage</a>().</p>


<h3 class="fn"><a name="drawPixmap-2" />QPainter.drawPixmap (<i>self</i>, <a href="qrect.html">QRect</a>&#160;<i>targetRect</i>, <a href="qpixmap.html">QPixmap</a>&#160;<i>pixmap</i>, <a href="qrect.html">QRect</a>&#160;<i>sourceRect</i>)</h3><p>This is an overloaded function.</p>
<p>Draws the rectangular portion <i>source</i> of the given
<i>pixmap</i> into the given <i>target</i> in the paint device.</p>
<p><b>Note:</b> The pixmap is scaled to fit the rectangle, if both
the pixmap and rectangle size disagree.</p>


<h3 class="fn"><a name="drawPixmap-3" />QPainter.drawPixmap (<i>self</i>, <a href="qpointf.html">QPointF</a>&#160;<i>p</i>, <a href="qpixmap.html">QPixmap</a>&#160;<i>pm</i>)</h3><p>This is an overloaded function.</p>
<p>Draws the rectangular portion <i>source</i> of the given
<i>pixmap</i> with its origin at the given <i>point</i>.</p>


<h3 class="fn"><a name="drawPixmap-4" />QPainter.drawPixmap (<i>self</i>, <a href="qpoint.html">QPoint</a>&#160;<i>p</i>, <a href="qpixmap.html">QPixmap</a>&#160;<i>pm</i>)</h3><p>This is an overloaded function.</p>
<p>Draws the rectangular portion <i>source</i> of the given
<i>pixmap</i> with its origin at the given <i>point</i>.</p>


<h3 class="fn"><a name="drawPixmap-5" />QPainter.drawPixmap (<i>self</i>, <a href="qrect.html">QRect</a>&#160;<i>r</i>, <a href="qpixmap.html">QPixmap</a>&#160;<i>pm</i>)</h3><p>This is an overloaded function.</p>
<p>Draws the given <i>pixmap</i> with its origin at the given
<i>point</i>.</p>


<h3 class="fn"><a name="drawPixmap-6" />QPainter.drawPixmap (<i>self</i>, int&#160;<i>x</i>, int&#160;<i>y</i>, <a href="qpixmap.html">QPixmap</a>&#160;<i>pm</i>)</h3><p>This is an overloaded function.</p>
<p>Draws the given <i>pixmap</i> with its origin at the given
<i>point</i>.</p>


<h3 class="fn"><a name="drawPixmap-7" />QPainter.drawPixmap (<i>self</i>, int&#160;<i>x</i>, int&#160;<i>y</i>, int&#160;<i>w</i>, int&#160;<i>h</i>, <a href="qpixmap.html">QPixmap</a>&#160;<i>pm</i>)</h3><p>This is an overloaded function.</p>
<p>Draws the given <i>pixmap</i> at position (<i>x</i>,
<i>y</i>).</p>


<h3 class="fn"><a name="drawPixmap-8" />QPainter.drawPixmap (<i>self</i>, int&#160;<i>x</i>, int&#160;<i>y</i>, int&#160;<i>w</i>, int&#160;<i>h</i>, <a href="qpixmap.html">QPixmap</a>&#160;<i>pm</i>, int&#160;<i>sx</i>, int&#160;<i>sy</i>, int&#160;<i>sw</i>, int&#160;<i>sh</i>)</h3><p>This is an overloaded function.</p>
<p>Draws the given <i>pixmap</i> into the given
<i>rectangle</i>.</p>
<p><b>Note:</b> The pixmap is scaled to fit the rectangle, if both
the pixmap and rectangle size disagree.</p>


<h3 class="fn"><a name="drawPixmap-9" />QPainter.drawPixmap (<i>self</i>, int&#160;<i>x</i>, int&#160;<i>y</i>, <a href="qpixmap.html">QPixmap</a>&#160;<i>pm</i>, int&#160;<i>sx</i>, int&#160;<i>sy</i>, int&#160;<i>sw</i>, int&#160;<i>sh</i>)</h3><p>This is an overloaded function.</p>
<p>Draws the <i>pixmap</i> into the rectangle at position
(<i>x</i>, <i>y</i>) with the given <i>width</i> and
<i>height</i>.</p>


<h3 class="fn"><a name="drawPixmap-10" />QPainter.drawPixmap (<i>self</i>, <a href="qpointf.html">QPointF</a>&#160;<i>p</i>, <a href="qpixmap.html">QPixmap</a>&#160;<i>pm</i>, <a href="qrectf.html">QRectF</a>&#160;<i>sr</i>)</h3><p>This is an overloaded function.</p>
<p>Draws the rectangular portion with the origin (<i>sx</i>,
<i>sy</i>), width <i>sw</i> and height <i>sh</i>, of the given
<i>pixmap</i> , at the point (<i>x</i>, <i>y</i>), with a width of
<i>w</i> and a height of <i>h</i>. If sw or sh are equal to zero
the width/height of the pixmap is used and adjusted by the offset
sx/sy;</p>


<h3 class="fn"><a name="drawPixmap-11" />QPainter.drawPixmap (<i>self</i>, <a href="qpoint.html">QPoint</a>&#160;<i>p</i>, <a href="qpixmap.html">QPixmap</a>&#160;<i>pm</i>, <a href="qrect.html">QRect</a>&#160;<i>sr</i>)</h3><p>This is an overloaded function.</p>
<p>Draws a pixmap at (<i>x</i>, <i>y</i>) by copying a part of the
given <i>pixmap</i> into the paint device.</p>
<p>(<i>x</i>, <i>y</i>) specifies the top-left point in the paint
device that is to be drawn onto. (<i>sx</i>, <i>sy</i>) specifies
the top-left point in <i>pixmap</i> that is to be drawn. The
default is (0, 0).</p>
<p>(<i>sw</i>, <i>sh</i>) specifies the size of the pixmap that is
to be drawn. The default, (0, 0) (and negative) means all the way
to the bottom-right of the pixmap.</p>


<h3 class="fn"><a name="drawPixmapFragments" />QPainter.drawPixmapFragments (<i>self</i>, list-of-QPainter.PixmapFragment&#160;<i>fragments</i>, <a href="qpixmap.html">QPixmap</a>&#160;<i>pixmap</i>, <a href="qpainter-pixmapfragmenthints.html">PixmapFragmentHints</a>&#160;<i>hints</i>&#160;=&#160;0)</h3><p>This function is used to draw <i>pixmap</i>, or a sub-rectangle
of <i>pixmap</i>, at multiple positions with different scale,
rotation and opacity. <i>fragments</i> is an array of
<i>fragmentCount</i> elements specifying the parameters used to
draw each pixmap fragment. The <i>hints</i> parameter can be used
to pass in drawing hints.</p>
<p>This function is potentially faster than multiple calls to
<a href="qpainter.html#drawPixmap">drawPixmap</a>(), since the
backend can optimize state changes.</p>
<p>This function was introduced in Qt 4.7.</p>
<p><b>See also</b> <a href="qpainter-pixmapfragment.html">QPainter.PixmapFragment</a> and
<a href="qpainter.html#PixmapFragmentHint-enum">QPainter.PixmapFragmentHint</a>.</p>


<h3 class="fn"><a name="drawPoint" />QPainter.drawPoint (<i>self</i>, <a href="qpointf.html">QPointF</a>&#160;<i>p</i>)</h3><p>Draws a single point at the given <i>position</i> using the
current pen's color.</p>
<p><b>See also</b> <a href="coordsys.html">Coordinate
System</a>.</p>


<h3 class="fn"><a name="drawPoint-2" />QPainter.drawPoint (<i>self</i>, int&#160;<i>x</i>, int&#160;<i>y</i>)</h3><p>This is an overloaded function.</p>
<p>Draws a single point at the given <i>position</i> using the
current pen's color.</p>


<h3 class="fn"><a name="drawPoint-3" />QPainter.drawPoint (<i>self</i>, <a href="qpoint.html">QPoint</a>&#160;<i>p</i>)</h3><p>This is an overloaded function.</p>
<p>Draws a single point at position (<i>x</i>, <i>y</i>).</p>


<h3 class="fn"><a name="drawPoints" />QPainter.drawPoints (<i>self</i>, <a href="qpointf.html">QPointF</a>&#160;<i>point</i>, ...)</h3><p>Draws the first <i>pointCount</i> points in the array
<i>points</i> using the current pen's color.</p>
<p><b>See also</b> <a href="coordsys.html">Coordinate
System</a>.</p>


<h3 class="fn"><a name="drawPoints-2" />QPainter.drawPoints (<i>self</i>, <a href="qpolygonf.html">QPolygonF</a>&#160;<i>points</i>)</h3><p>This is an overloaded function.</p>
<p>Draws the first <i>pointCount</i> points in the array
<i>points</i> using the current pen's color.</p>


<h3 class="fn"><a name="drawPoints-3" />QPainter.drawPoints (<i>self</i>, <a href="qpoint.html">QPoint</a>&#160;<i>point</i>, ...)</h3><p>This is an overloaded function.</p>
<p>Draws the points in the vector <i>points</i>.</p>


<h3 class="fn"><a name="drawPoints-4" />QPainter.drawPoints (<i>self</i>, <a href="qpolygon.html">QPolygon</a>&#160;<i>points</i>)</h3><p>This is an overloaded function.</p>
<p>Draws the points in the vector <i>points</i>.</p>


<h3 class="fn"><a name="drawPolygon" />QPainter.drawPolygon (<i>self</i>, <a href="qpointf.html">QPointF</a>&#160;<i>point</i>, ...)</h3><p>Draws the polygon defined by the first <i>pointCount</i> points
in the array <i>points</i> using the current pen and brush.</p>
<table class="generic" width="100%">
<tr class="odd" valign="top">
<td><img src="images/qpainter-polygon.png" /></td>
<td>
<pre class="cpp">
 <span class="keyword">static</span> <span class="keyword">const</span> <span class="type"><a href="qpointf.html">QPointF</a></span> points<span class="operator">[</span><span class="number">4</span><span class="operator">]</span> <span class="operator">=</span> {
     <span class="type"><a href="qpointf.html">QPointF</a></span>(<span class="number">10.0</span><span class="operator">,</span> <span class="number">80.0</span>)<span class="operator">,</span>
     <span class="type"><a href="qpointf.html">QPointF</a></span>(<span class="number">20.0</span><span class="operator">,</span> <span class="number">10.0</span>)<span class="operator">,</span>
     <span class="type"><a href="qpointf.html">QPointF</a></span>(<span class="number">80.0</span><span class="operator">,</span> <span class="number">30.0</span>)<span class="operator">,</span>
     <span class="type"><a href="qpointf.html">QPointF</a></span>(<span class="number">90.0</span><span class="operator">,</span> <span class="number">70.0</span>)
 };

 <span class="type"><a href="qpainter.html">QPainter</a></span> painter(<span class="keyword">this</span>);
 painter<span class="operator">.</span>drawPolygon(points<span class="operator">,</span> <span class="number">4</span>);
</pre></td>
</tr>
</table>
<p>The first point is implicitly connected to the last point, and
the polygon is filled with the current <a href="qpainter.html#brush">brush</a>().</p>
<p>If <i>fillRule</i> is <a href="qt.html#FillRule-enum">Qt.WindingFill</a>, the polygon is filled
using the winding fill algorithm. If <i>fillRule</i> is <a href="qt.html#FillRule-enum">Qt.OddEvenFill</a>, the polygon is filled
using the odd-even fill algorithm. See <a href="qt.html#FillRule-enum">Qt.FillRule</a> for a more detailed
description of these fill rules.</p>
<p><b>See also</b> <a href="qpainter.html#drawConvexPolygon">drawConvexPolygon</a>(), <a href="qpainter.html#drawPolyline">drawPolyline</a>(), and <a href="coordsys.html">Coordinate System</a>.</p>


<h3 class="fn"><a name="drawPolygon-2" />QPainter.drawPolygon (<i>self</i>, <a href="qpolygonf.html">QPolygonF</a>&#160;<i>points</i>, <a href="qt.html#FillRule-enum">Qt.FillRule</a>&#160;<i>fillRule</i>&#160;=&#160;Qt.OddEvenFill)</h3><p>This is an overloaded function.</p>
<p>Draws the polygon defined by the first <i>pointCount</i> points
in the array <i>points</i>.</p>


<h3 class="fn"><a name="drawPolygon-3" />QPainter.drawPolygon (<i>self</i>, <a href="qpoint.html">QPoint</a>&#160;<i>point</i>, ...)</h3><h3 class="fn"><a name="drawPolygon-4" />QPainter.drawPolygon (<i>self</i>, <a href="qpolygon.html">QPolygon</a>&#160;<i>points</i>, <a href="qt.html#FillRule-enum">Qt.FillRule</a>&#160;<i>fillRule</i>&#160;=&#160;Qt.OddEvenFill)</h3><h3 class="fn"><a name="drawPolyline" />QPainter.drawPolyline (<i>self</i>, <a href="qpointf.html">QPointF</a>&#160;<i>point</i>, ...)</h3><p>Draws the polyline defined by the first <i>pointCount</i> points
in <i>points</i> using the current pen.</p>
<p>Note that unlike the <a href="qpainter.html#drawPolygon">drawPolygon</a>() function the last
point is <i>not</i> connected to the first, neither is the polyline
filled.</p>
<table class="generic" width="100%">
<tr class="odd" valign="top">
<td>
<pre class="cpp">
 <span class="keyword">static</span> <span class="keyword">const</span> <span class="type"><a href="qpointf.html">QPointF</a></span> points<span class="operator">[</span><span class="number">3</span><span class="operator">]</span> <span class="operator">=</span> {
     <span class="type"><a href="qpointf.html">QPointF</a></span>(<span class="number">10.0</span><span class="operator">,</span> <span class="number">80.0</span>)<span class="operator">,</span>
     <span class="type"><a href="qpointf.html">QPointF</a></span>(<span class="number">20.0</span><span class="operator">,</span> <span class="number">10.0</span>)<span class="operator">,</span>
     <span class="type"><a href="qpointf.html">QPointF</a></span>(<span class="number">80.0</span><span class="operator">,</span> <span class="number">30.0</span>)<span class="operator">,</span>
 };

 <span class="type"><a href="qpainter.html">QPainter</a></span> painter(<span class="keyword">this</span>);
 painter<span class="operator">.</span>drawPolyline(points<span class="operator">,</span> <span class="number">3</span>);
</pre></td>
</tr>
</table>
<p><b>See also</b> <a href="qpainter.html#drawLines">drawLines</a>(), <a href="qpainter.html#drawPolygon">drawPolygon</a>(), and <a href="coordsys.html">Coordinate System</a>.</p>


<h3 class="fn"><a name="drawPolyline-2" />QPainter.drawPolyline (<i>self</i>, <a href="qpolygonf.html">QPolygonF</a>&#160;<i>polyline</i>)</h3><p>This is an overloaded function.</p>
<p>Draws the polyline defined by the first <i>pointCount</i> points
in <i>points</i> using the current pen.</p>


<h3 class="fn"><a name="drawPolyline-3" />QPainter.drawPolyline (<i>self</i>, <a href="qpoint.html">QPoint</a>&#160;<i>point</i>, ...)</h3><h3 class="fn"><a name="drawPolyline-4" />QPainter.drawPolyline (<i>self</i>, <a href="qpolygon.html">QPolygon</a>&#160;<i>polyline</i>)</h3><p>This is an overloaded function.</p>
<p>Draws the polyline defined by the given <i>points</i> using the
current pen.</p>


<h3 class="fn"><a name="drawRect" />QPainter.drawRect (<i>self</i>, <a href="qrectf.html">QRectF</a>&#160;<i>rect</i>)</h3><p>Draws the current <i>rectangle</i> with the current pen and
brush.</p>
<p>A filled rectangle has a size of <i>rectangle</i>.size(). A
stroked rectangle has a size of <i>rectangle</i>.size() plus the
pen width.</p>
<table class="generic" width="100%">
<tr class="odd" valign="top">
<td><img src="images/qpainter-rectangle.png" /></td>
<td>
<pre class="cpp">
 <span class="type"><a href="qrectf.html">QRectF</a></span> rectangle(<span class="number">10.0</span><span class="operator">,</span> <span class="number">20.0</span><span class="operator">,</span> <span class="number">80.0</span><span class="operator">,</span> <span class="number">60.0</span>);

 <span class="type"><a href="qpainter.html">QPainter</a></span> painter(<span class="keyword">this</span>);
 painter<span class="operator">.</span>drawRect(rectangle);
</pre></td>
</tr>
</table>
<p><b>See also</b> <a href="qpainter.html#drawRects">drawRects</a>(), <a href="qpainter.html#drawPolygon">drawPolygon</a>(), and <a href="coordsys.html">Coordinate System</a>.</p>


<h3 class="fn"><a name="drawRect-2" />QPainter.drawRect (<i>self</i>, int&#160;<i>x</i>, int&#160;<i>y</i>, int&#160;<i>w</i>, int&#160;<i>h</i>)</h3><p>This is an overloaded function.</p>
<p>Draws the current <i>rectangle</i> with the current pen and
brush.</p>


<h3 class="fn"><a name="drawRect-3" />QPainter.drawRect (<i>self</i>, <a href="qrect.html">QRect</a>&#160;<i>r</i>)</h3><p>This is an overloaded function.</p>
<p>Draws a rectangle with upper left corner at (<i>x</i>, <i>y</i>)
and with the given <i>width</i> and <i>height</i>.</p>


<h3 class="fn"><a name="drawRects" />QPainter.drawRects (<i>self</i>, <a href="qrectf.html">QRectF</a>&#160;<i>rect</i>, ...)</h3><p>Draws the first <i>rectCount</i> of the given <i>rectangles</i>
using the current pen and brush.</p>
<p><b>See also</b> <a href="qpainter.html#drawRect">drawRect</a>().</p>


<h3 class="fn"><a name="drawRects-2" />QPainter.drawRects (<i>self</i>, list-of-QRectF&#160;<i>rects</i>)</h3><p>This is an overloaded function.</p>
<p>Draws the first <i>rectCount</i> of the given <i>rectangles</i>
using the current pen and brush.</p>


<h3 class="fn"><a name="drawRects-3" />QPainter.drawRects (<i>self</i>, <a href="qrect.html">QRect</a>&#160;<i>rect</i>, ...)</h3><p>This is an overloaded function.</p>
<p>Draws the given <i>rectangles</i> using the current pen and
brush.</p>


<h3 class="fn"><a name="drawRects-4" />QPainter.drawRects (<i>self</i>, list-of-QRect&#160;<i>rects</i>)</h3><p>This is an overloaded function.</p>
<p>Draws the given <i>rectangles</i> using the current pen and
brush.</p>


<h3 class="fn"><a name="drawRoundedRect" />QPainter.drawRoundedRect (<i>self</i>, <a href="qrectf.html">QRectF</a>&#160;<i>rect</i>, float&#160;<i>xRadius</i>, float&#160;<i>yRadius</i>, <a href="qt.html#SizeMode-enum">Qt.SizeMode</a>&#160;<i>mode</i>&#160;=&#160;Qt.AbsoluteSize)</h3><p>Draws the given rectangle <i>rect</i> with rounded corners.</p>
<p>The <i>xRadius</i> and <i>yRadius</i> arguments specify the
radii of the ellipses defining the corners of the rounded
rectangle. When <i>mode</i> is <a href="qt.html#SizeMode-enum">Qt.RelativeSize</a>, <i>xRadius</i> and
<i>yRadius</i> are specified in percentage of half the rectangle's
width and height respectively, and should be in the range 0.0 to
100.0.</p>
<p>A filled rectangle has a size of rect.size(). A stroked
rectangle has a size of rect.size() plus the pen width.</p>
<table class="generic" width="100%">
<tr class="odd" valign="top">
<td><img src="images/qpainter-roundrect.png" /></td>
<td>
<pre class="cpp">
 <span class="type"><a href="qrectf.html">QRectF</a></span> rectangle(<span class="number">10.0</span><span class="operator">,</span> <span class="number">20.0</span><span class="operator">,</span> <span class="number">80.0</span><span class="operator">,</span> <span class="number">60.0</span>);

 <span class="type"><a href="qpainter.html">QPainter</a></span> painter(<span class="keyword">this</span>);
 painter<span class="operator">.</span>drawRoundedRect(rectangle<span class="operator">,</span> <span class="number">20.0</span><span class="operator">,</span> <span class="number">15.0</span>);
</pre></td>
</tr>
</table>
<p>This function was introduced in Qt 4.4.</p>
<p><b>See also</b> <a href="qpainter.html#drawRect">drawRect</a>()
and <a href="qpen.html">QPen</a>.</p>


<h3 class="fn"><a name="drawRoundedRect-2" />QPainter.drawRoundedRect (<i>self</i>, int&#160;<i>x</i>, int&#160;<i>y</i>, int&#160;<i>w</i>, int&#160;<i>h</i>, float&#160;<i>xRadius</i>, float&#160;<i>yRadius</i>, <a href="qt.html#SizeMode-enum">Qt.SizeMode</a>&#160;<i>mode</i>&#160;=&#160;Qt.AbsoluteSize)</h3><p>This is an overloaded function.</p>
<p>Draws the given rectangle <i>rect</i> with rounded corners.</p>
<p>This function was introduced in Qt 4.4.</p>


<h3 class="fn"><a name="drawRoundedRect-3" />QPainter.drawRoundedRect (<i>self</i>, <a href="qrect.html">QRect</a>&#160;<i>rect</i>, float&#160;<i>xRadius</i>, float&#160;<i>yRadius</i>, <a href="qt.html#SizeMode-enum">Qt.SizeMode</a>&#160;<i>mode</i>&#160;=&#160;Qt.AbsoluteSize)</h3><p>This is an overloaded function.</p>
<p>Draws the given rectangle <i>x</i>, <i>y</i>, <i>w</i>, <i>h</i>
with rounded corners.</p>
<p>This function was introduced in Qt 4.4.</p>


<h3 class="fn"><a name="drawRoundRect" />QPainter.drawRoundRect (<i>self</i>, <a href="qrectf.html">QRectF</a>&#160;<i>r</i>, int&#160;<i>xRound</i>&#160;=&#160;25, int&#160;<i>yRound</i>&#160;=&#160;25)</h3><h3 class="fn"><a name="drawRoundRect-2" />QPainter.drawRoundRect (<i>self</i>, int&#160;<i>x</i>, int&#160;<i>y</i>, int&#160;<i>w</i>, int&#160;<i>h</i>, int&#160;<i>xRound</i>&#160;=&#160;25, int&#160;<i>yRound</i>&#160;=&#160;25)</h3><h3 class="fn"><a name="drawRoundRect-3" />QPainter.drawRoundRect (<i>self</i>, <a href="qrect.html">QRect</a>&#160;<i>r</i>, int&#160;<i>xRound</i>&#160;=&#160;25, int&#160;<i>yRound</i>&#160;=&#160;25)</h3><h3 class="fn"><a name="drawStaticText" />QPainter.drawStaticText (<i>self</i>, <a href="qpointf.html">QPointF</a>&#160;<i>topLeftPosition</i>, <a href="qstatictext.html">QStaticText</a>&#160;<i>staticText</i>)</h3><p>Draws the given <i>staticText</i> at the given
<i>topLeftPosition</i>.</p>
<p>The text will be drawn using the font and the transformation set
on the painter. If the font and/or transformation set on the
painter are different from the ones used to initialize the layout
of the <a href="qstatictext.html">QStaticText</a>, then the layout
will have to be recalculated. Use <a href="qstatictext.html#prepare">QStaticText.prepare</a>() to initialize
<i>staticText</i> with the font and transformation with which it
will later be drawn.</p>
<p>If <i>topLeftPosition</i> is not the same as when
<i>staticText</i> was initialized, or when it was last drawn, then
there will be a slight overhead when translating the text to its
new position.</p>
<p><b>Note:</b> If the painter's transformation is not affine, then
<i>staticText</i> will be drawn using regular calls to <a href="qpainter.html#drawText">drawText</a>(), losing any potential for
performance improvement.</p>
<p><b>Note:</b> The y-position is used as the top of the font.</p>
<p>This function was introduced in Qt 4.7.</p>
<p><b>See also</b> <a href="qstatictext.html">QStaticText</a>.</p>


<h3 class="fn"><a name="drawStaticText-2" />QPainter.drawStaticText (<i>self</i>, <a href="qpoint.html">QPoint</a>&#160;<i>p</i>, <a href="qstatictext.html">QStaticText</a>&#160;<i>staticText</i>)</h3><p>This is an overloaded function.</p>
<p>Draws the <i>staticText</i> at the <i>topLeftPosition</i>.</p>
<p><b>Note:</b> The y-position is used as the top of the font.</p>
<p>This function was introduced in Qt 4.7.</p>


<h3 class="fn"><a name="drawStaticText-3" />QPainter.drawStaticText (<i>self</i>, int&#160;<i>x</i>, int&#160;<i>y</i>, <a href="qstatictext.html">QStaticText</a>&#160;<i>staticText</i>)</h3><p>This is an overloaded function.</p>
<p>Draws the <i>staticText</i> at coordinates <i>left</i> and
<i>top</i>.</p>
<p><b>Note:</b> The y-position is used as the top of the font.</p>
<p>This function was introduced in Qt 4.7.</p>


<h3 class="fn"><a name="drawText" />QPainter.drawText (<i>self</i>, <a href="qpointf.html">QPointF</a>&#160;<i>p</i>, QString&#160;<i>s</i>)</h3><p>Draws the given <i>text</i> with the currently defined text
direction, beginning at the given <i>position</i>.</p>
<p>This function does not handle the newline character (\n), as it
cannot break text into multiple lines, and it cannot display the
newline character. Use the QPainter.drawText() overload that takes
a rectangle instead if you want to draw multiple lines of text with
the newline character, or if you want the text to be wrapped.</p>
<p>By default, <a href="qpainter.html">QPainter</a> draws text
anti-aliased.</p>
<p><b>Note:</b> The y-position is used as the baseline of the
font.</p>


<h3 class="fn"><a name="drawText-2" /><a href="qrectf.html">QRectF</a>&#160;<i>boundingRect</i> QPainter.drawText (<i>self</i>, <a href="qrectf.html">QRectF</a>&#160;<i>rectangle</i>, int&#160;<i>flags</i>, QString&#160;<i>text</i>)</h3><h3 class="fn"><a name="drawText-3" /><a href="qrect.html">QRect</a>&#160;<i>boundingRect</i> QPainter.drawText (<i>self</i>, <a href="qrect.html">QRect</a>&#160;<i>rectangle</i>, int&#160;<i>flags</i>, QString&#160;<i>text</i>)</h3><h3 class="fn"><a name="drawText-4" />QPainter.drawText (<i>self</i>, <a href="qrectf.html">QRectF</a>&#160;<i>rectangle</i>, QString&#160;<i>text</i>, <a href="qtextoption.html">QTextOption</a>&#160;<i>option</i>&#160;=&#160;QTextOption())</h3><h3 class="fn"><a name="drawText-5" />QPainter.drawText (<i>self</i>, <a href="qpoint.html">QPoint</a>&#160;<i>p</i>, QString&#160;<i>s</i>)</h3><h3 class="fn"><a name="drawText-6" /><a href="qrect.html">QRect</a>&#160;<i>boundingRect</i> QPainter.drawText (<i>self</i>, int&#160;<i>x</i>, int&#160;<i>y</i>, int&#160;<i>width</i>, int&#160;<i>height</i>, int&#160;<i>flags</i>, QString&#160;<i>text</i>)</h3><h3 class="fn"><a name="drawText-7" />QPainter.drawText (<i>self</i>, int&#160;<i>x</i>, int&#160;<i>y</i>, QString&#160;<i>s</i>)</h3><h3 class="fn"><a name="drawTiledPixmap" />QPainter.drawTiledPixmap (<i>self</i>, <a href="qrectf.html">QRectF</a>&#160;<i>rectangle</i>, <a href="qpixmap.html">QPixmap</a>&#160;<i>pixmap</i>, <a href="qpointf.html">QPointF</a>&#160;<i>pos</i>&#160;=&#160;QPointF())</h3><p>Draws a tiled <i>pixmap</i>, inside the given <i>rectangle</i>
with its origin at the given <i>position</i>.</p>
<p>Calling drawTiledPixmap() is similar to calling <a href="qpainter.html#drawPixmap">drawPixmap</a>() several times to fill
(tile) an area with a pixmap, but is potentially much more
efficient depending on the underlying window system.</p>
<p><b>See also</b> <a href="qpainter.html#drawPixmap">drawPixmap</a>().</p>


<h3 class="fn"><a name="drawTiledPixmap-2" />QPainter.drawTiledPixmap (<i>self</i>, <a href="qrect.html">QRect</a>&#160;<i>rectangle</i>, <a href="qpixmap.html">QPixmap</a>&#160;<i>pixmap</i>, <a href="qpoint.html">QPoint</a>&#160;<i>pos</i>&#160;=&#160;QPoint())</h3><p>This is an overloaded function.</p>
<p>Draws a tiled <i>pixmap</i>, inside the given <i>rectangle</i>
with its origin at the given <i>position</i>.</p>


<h3 class="fn"><a name="drawTiledPixmap-3" />QPainter.drawTiledPixmap (<i>self</i>, int&#160;<i>x</i>, int&#160;<i>y</i>, int&#160;<i>width</i>, int&#160;<i>height</i>, <a href="qpixmap.html">QPixmap</a>&#160;<i>pixmap</i>, int&#160;<i>sx</i>&#160;=&#160;0, int&#160;<i>sy</i>&#160;=&#160;0)</h3><p>This is an overloaded function.</p>
<p>Draws a tiled <i>pixmap</i> in the specified rectangle.</p>
<p>(<i>x</i>, <i>y</i>) specifies the top-left point in the paint
device that is to be drawn onto; with the given <i>width</i> and
<i>height</i>. (<i>sx</i>, <i>sy</i>) specifies the top-left point
in the <i>pixmap</i> that is to be drawn; this defaults to (0,
0).</p>


<h3 class="fn"><a name="end" />bool QPainter.end (<i>self</i>)</h3><p>Ends painting. Any resources used while painting are released.
You don't normally need to call this since it is called by the
destructor.</p>
<p>Returns true if the painter is no longer active; otherwise
returns false.</p>
<p><b>See also</b> <a href="qpainter.html#begin">begin</a>() and
<a href="qpainter.html#isActive">isActive</a>().</p>


<h3 class="fn"><a name="endNativePainting" />QPainter.endNativePainting (<i>self</i>)</h3><p>Restores the painter after manually issuing native painting
commands. Lets the painter restore any native state that it relies
on before calling any other painter commands.</p>
<p>This function was introduced in Qt 4.6.</p>
<p><b>See also</b> <a href="qpainter.html#beginNativePainting">beginNativePainting</a>().</p>


<h3 class="fn"><a name="eraseRect" />QPainter.eraseRect (<i>self</i>, <a href="qrectf.html">QRectF</a>)</h3><p>Erases the area inside the given <i>rectangle</i>. Equivalent to
calling</p>
<pre class="cpp">
 <a href="qpainter.html#fillRect">fillRect</a>(rectangle<span class="operator">,</span> background())<span class="operator">.</span>
</pre>
<p><b>See also</b> <a href="qpainter.html#fillRect">fillRect</a>().</p>


<h3 class="fn"><a name="eraseRect-2" />QPainter.eraseRect (<i>self</i>, <a href="qrect.html">QRect</a>&#160;<i>rect</i>)</h3><p>This is an overloaded function.</p>
<p>Erases the area inside the given <i>rectangle</i>.</p>


<h3 class="fn"><a name="eraseRect-3" />QPainter.eraseRect (<i>self</i>, int&#160;<i>x</i>, int&#160;<i>y</i>, int&#160;<i>w</i>, int&#160;<i>h</i>)</h3><p>This is an overloaded function.</p>
<p>Erases the area inside the rectangle beginning at (<i>x</i>,
<i>y</i>) with the given <i>width</i> and <i>height</i>.</p>


<h3 class="fn"><a name="fillPath" />QPainter.fillPath (<i>self</i>, <a href="qpainterpath.html">QPainterPath</a>&#160;<i>path</i>, <a href="qbrush.html">QBrush</a>&#160;<i>brush</i>)</h3><p>Fills the given <i>path</i> using the given <i>brush</i>. The
outline is not drawn.</p>
<p>Alternatively, you can specify a <a href="qcolor.html">QColor</a> instead of a <a href="qbrush.html">QBrush</a>; the <a href="qbrush.html">QBrush</a>
constructor (taking a <a href="qcolor.html">QColor</a> argument)
will automatically create a solid pattern brush.</p>
<p><b>See also</b> <a href="qpainter.html#drawPath">drawPath</a>().</p>


<h3 class="fn"><a name="fillRect" />QPainter.fillRect (<i>self</i>, <a href="qrectf.html">QRectF</a>, <a href="qbrush.html">QBrush</a>)</h3><p>Fills the given <i>rectangle</i> with the <i>brush</i>
specified.</p>
<p>Alternatively, you can specify a <a href="qcolor.html">QColor</a> instead of a <a href="qbrush.html">QBrush</a>; the <a href="qbrush.html">QBrush</a>
constructor (taking a <a href="qcolor.html">QColor</a> argument)
will automatically create a solid pattern brush.</p>
<p><b>See also</b> <a href="qpainter.html#drawRect">drawRect</a>().</p>


<h3 class="fn"><a name="fillRect-2" />QPainter.fillRect (<i>self</i>, <a href="qrect.html">QRect</a>, <a href="qbrush.html">QBrush</a>)</h3><p>This is an overloaded function.</p>
<p>Fills the rectangle beginning at (<i>x</i>, <i>y</i>) with the
given <i>width</i> and <i>height</i>, using the brush <i>style</i>
specified.</p>
<p>This function was introduced in Qt 4.5.</p>


<h3 class="fn"><a name="fillRect-3" />QPainter.fillRect (<i>self</i>, int&#160;<i>x</i>, int&#160;<i>y</i>, int&#160;<i>w</i>, int&#160;<i>h</i>, <a href="qbrush.html">QBrush</a>&#160;<i>b</i>)</h3><p>This is an overloaded function.</p>
<p>Fills the given <i>rectangle</i> with the brush <i>style</i>
specified.</p>
<p>This function was introduced in Qt 4.5.</p>


<h3 class="fn"><a name="fillRect-4" />QPainter.fillRect (<i>self</i>, <a href="qrectf.html">QRectF</a>, <a href="qcolor.html">QColor</a>&#160;<i>color</i>)</h3><p>This is an overloaded function.</p>
<p>Fills the given <i>rectangle</i> with the brush <i>style</i>
specified.</p>
<p>This function was introduced in Qt 4.5.</p>


<h3 class="fn"><a name="fillRect-5" />QPainter.fillRect (<i>self</i>, <a href="qrect.html">QRect</a>, <a href="qcolor.html">QColor</a>&#160;<i>color</i>)</h3><p>This is an overloaded function.</p>
<p>Fills the given <i>rectangle</i> with the specified
<i>brush</i>.</p>


<h3 class="fn"><a name="fillRect-6" />QPainter.fillRect (<i>self</i>, int&#160;<i>x</i>, int&#160;<i>y</i>, int&#160;<i>w</i>, int&#160;<i>h</i>, <a href="qcolor.html">QColor</a>&#160;<i>b</i>)</h3><p>This is an overloaded function.</p>
<p>Fills the given <i>rectangle</i> with the <i>color</i>
specified.</p>
<p>This function was introduced in Qt 4.5.</p>


<h3 class="fn"><a name="fillRect-7" />QPainter.fillRect (<i>self</i>, int&#160;<i>x</i>, int&#160;<i>y</i>, int&#160;<i>w</i>, int&#160;<i>h</i>, <a href="qt.html#GlobalColor-enum">Qt.GlobalColor</a>&#160;<i>c</i>)</h3><p>This is an overloaded function.</p>
<p>Fills the given <i>rectangle</i> with the <i>color</i>
specified.</p>
<p>This function was introduced in Qt 4.5.</p>


<h3 class="fn"><a name="fillRect-8" />QPainter.fillRect (<i>self</i>, <a href="qrect.html">QRect</a>&#160;<i>r</i>, <a href="qt.html#GlobalColor-enum">Qt.GlobalColor</a>&#160;<i>c</i>)</h3><p>This is an overloaded function.</p>
<p>Fills the rectangle beginning at (<i>x</i>, <i>y</i>) with the
given <i>width</i> and <i>height</i>, using the given
<i>brush</i>.</p>


<h3 class="fn"><a name="fillRect-9" />QPainter.fillRect (<i>self</i>, <a href="qrectf.html">QRectF</a>&#160;<i>r</i>, <a href="qt.html#GlobalColor-enum">Qt.GlobalColor</a>&#160;<i>c</i>)</h3><p>This is an overloaded function.</p>
<p>Fills the rectangle beginning at (<i>x</i>, <i>y</i>) with the
given <i>width</i> and <i>height</i>, using the given
<i>color</i>.</p>
<p>This function was introduced in Qt 4.5.</p>


<h3 class="fn"><a name="fillRect-10" />QPainter.fillRect (<i>self</i>, int&#160;<i>x</i>, int&#160;<i>y</i>, int&#160;<i>w</i>, int&#160;<i>h</i>, <a href="qt.html#BrushStyle-enum">Qt.BrushStyle</a>&#160;<i>style</i>)</h3><p>This is an overloaded function.</p>
<p>Fills the rectangle beginning at (<i>x</i>, <i>y</i>) with the
given <i>width</i> and <i>height</i>, using the given
<i>color</i>.</p>
<p>This function was introduced in Qt 4.5.</p>


<h3 class="fn"><a name="fillRect-11" />QPainter.fillRect (<i>self</i>, <a href="qrect.html">QRect</a>&#160;<i>r</i>, <a href="qt.html#BrushStyle-enum">Qt.BrushStyle</a>&#160;<i>style</i>)</h3><p>This is an overloaded function.</p>
<p>Fills the given <i>rectangle</i> with the specified
<i>color</i>.</p>
<p>This function was introduced in Qt 4.5.</p>


<h3 class="fn"><a name="fillRect-12" />QPainter.fillRect (<i>self</i>, <a href="qrectf.html">QRectF</a>&#160;<i>r</i>, <a href="qt.html#BrushStyle-enum">Qt.BrushStyle</a>&#160;<i>style</i>)</h3><p>This is an overloaded function.</p>
<p>Fills the given <i>rectangle</i> with the specified
<i>color</i>.</p>
<p>This function was introduced in Qt 4.5.</p>


<h3 class="fn"><a name="font" /><a href="qfont.html">QFont</a> QPainter.font (<i>self</i>)</h3><p>Returns the currently set font used for drawing text.</p>
<p><b>See also</b> <a href="qpainter.html#setFont">setFont</a>(),
<a href="qpainter.html#drawText">drawText</a>(), and <a href="qpainter.html#settings">Settings</a>.</p>


<h3 class="fn"><a name="fontInfo" /><a href="qfontinfo.html">QFontInfo</a> QPainter.fontInfo (<i>self</i>)</h3><p>Returns the font info for the painter if the painter is active.
Otherwise, the return value is undefined.</p>
<p><b>See also</b> <a href="qpainter.html#font">font</a>(),
<a href="qpainter.html#isActive">isActive</a>(), and <a href="qpainter.html#settings">Settings</a>.</p>


<h3 class="fn"><a name="fontMetrics" /><a href="qfontmetrics.html">QFontMetrics</a> QPainter.fontMetrics (<i>self</i>)</h3><p>Returns the font metrics for the painter if the painter is
active. Otherwise, the return value is undefined.</p>
<p><b>See also</b> <a href="qpainter.html#font">font</a>(),
<a href="qpainter.html#isActive">isActive</a>(), and <a href="qpainter.html#settings">Settings</a>.</p>


<h3 class="fn"><a name="hasClipping" />bool QPainter.hasClipping (<i>self</i>)</h3><p>Returns true if clipping has been set; otherwise returns
false.</p>
<p><b>See also</b> <a href="qpainter.html#setClipping">setClipping</a>() and <a href="qpainter.html#clipping">Clipping</a>.</p>


<h3 class="fn"><a name="initFrom" />QPainter.initFrom (<i>self</i>, <a href="qwidget.html">QWidget</a>&#160;<i>widget</i>)</h3><p>Initializes the painters pen, background and font to the same as
the given <i>widget</i>. This function is called automatically when
the painter is opened on a <a href="qwidget.html">QWidget</a>.</p>
<p><b>See also</b> <a href="qpainter.html#begin">begin</a>() and
<a href="qpainter.html#settings">Settings</a>.</p>


<h3 class="fn"><a name="isActive" />bool QPainter.isActive (<i>self</i>)</h3><p>Returns true if <a href="qpainter.html#begin">begin</a>() has
been called and <a href="qpainter.html#end">end</a>() has not yet
been called; otherwise returns false.</p>
<p><b>See also</b> <a href="qpainter.html#begin">begin</a>() and
<a href="qpaintdevice.html#paintingActive">QPaintDevice.paintingActive</a>().</p>


<h3 class="fn"><a name="layoutDirection" /><a href="qt.html#LayoutDirection-enum">Qt.LayoutDirection</a> QPainter.layoutDirection (<i>self</i>)</h3><p>Returns the layout direction used by the painter when drawing
text.</p>
<p><b>See also</b> <a href="qtextoption.html#textDirection">QTextOption.textDirection</a>(),
<a href="qpainter.html#setLayoutDirection">setLayoutDirection</a>(),
<a href="qpainter.html#drawText">drawText</a>(), and <a href="qpainter.html#settings">Settings</a>.</p>


<h3 class="fn"><a name="matrix" /><a href="qmatrix.html">QMatrix</a> QPainter.matrix (<i>self</i>)</h3><h3 class="fn"><a name="matrixEnabled" />bool QPainter.matrixEnabled (<i>self</i>)</h3><h3 class="fn"><a name="opacity" />float QPainter.opacity (<i>self</i>)</h3><p>Returns the opacity of the painter. The default value is 1.</p>
<p>This function was introduced in Qt 4.2.</p>
<p><b>See also</b> <a href="qpainter.html#setOpacity">setOpacity</a>().</p>


<h3 class="fn"><a name="paintEngine" /><a href="qpaintengine.html">QPaintEngine</a> QPainter.paintEngine (<i>self</i>)</h3><p>Returns the paint engine that the painter is currently operating
on if the painter is active; otherwise 0.</p>
<p><b>See also</b> <a href="qpainter.html#isActive">isActive</a>().</p>


<h3 class="fn"><a name="pen" /><a href="qpen.html">QPen</a> QPainter.pen (<i>self</i>)</h3><p>Returns the painter's current pen.</p>
<p><b>See also</b> <a href="qpainter.html#setPen">setPen</a>() and
<a href="qpainter.html#settings">Settings</a>.</p>


<h3 class="fn"><a name="redirected" /><a href="qpaintdevice.html">QPaintDevice</a> QPainter.redirected (<a href="qpaintdevice.html">QPaintDevice</a>&#160;<i>device</i>, <a href="qpoint.html">QPoint</a>&#160;<i>offset</i>&#160;=&#160;None)</h3><h3 class="fn"><a name="renderHints" /><a href="qpainter-renderhints.html">RenderHints</a> QPainter.renderHints (<i>self</i>)</h3><p>Returns a flag that specifies the rendering hints that are set
for this painter.</p>
<p><b>See also</b> <a href="qpainter.html#setRenderHints">setRenderHints</a>(), <a href="qpainter.html#testRenderHint">testRenderHint</a>(), and <a href="qpainter.html#rendering-quality">Rendering Quality</a>.</p>


<h3 class="fn"><a name="resetMatrix" />QPainter.resetMatrix (<i>self</i>)</h3><h3 class="fn"><a name="resetTransform" />QPainter.resetTransform (<i>self</i>)</h3><p>Resets any transformations that were made using <a href="qpainter.html#translate">translate</a>(), <a href="qpainter.html#scale">scale</a>(), <a href="qpainter.html#shear">shear</a>(), <a href="qpainter.html#rotate">rotate</a>(), <a href="qpainter.html#setWorldTransform">setWorldTransform</a>(), <a href="qpainter.html#setViewport">setViewport</a>() and <a href="qpainter.html#setWindow">setWindow</a>().</p>
<p><b>See also</b> <a href="qpainter.html#coordinate-transformations">Coordinate
Transformations</a>.</p>


<h3 class="fn"><a name="restore" />QPainter.restore (<i>self</i>)</h3><p>Restores the current painter state (pops a saved state off the
stack).</p>
<p><b>See also</b> <a href="qpainter.html#save">save</a>().</p>


<h3 class="fn"><a name="restoreRedirected" />QPainter.restoreRedirected (<a href="qpaintdevice.html">QPaintDevice</a>&#160;<i>device</i>)</h3><h3 class="fn"><a name="rotate" />QPainter.rotate (<i>self</i>, float&#160;<i>a</i>)</h3><p>Rotates the coordinate system the given <i>angle</i>
clockwise.</p>
<p><b>See also</b> <a href="qpainter.html#setWorldTransform">setWorldTransform</a>() and
<a href="qpainter.html#coordinate-transformations">Coordinate
Transformations</a>.</p>


<h3 class="fn"><a name="save" />QPainter.save (<i>self</i>)</h3><p>Saves the current painter state (pushes the state onto a stack).
A save() must be followed by a corresponding <a href="qpainter.html#restore">restore</a>(); the <a href="qpainter.html#end">end</a>() function unwinds the stack.</p>
<p><b>See also</b> <a href="qpainter.html#restore">restore</a>().</p>


<h3 class="fn"><a name="scale" />QPainter.scale (<i>self</i>, float&#160;<i>sx</i>, float&#160;<i>sy</i>)</h3><p>Scales the coordinate system by (<i>sx</i>, <i>sy</i>).</p>
<p><b>See also</b> <a href="qpainter.html#setWorldTransform">setWorldTransform</a>() and
<a href="qpainter.html#coordinate-transformations">Coordinate
Transformations</a>.</p>


<h3 class="fn"><a name="setBackground" />QPainter.setBackground (<i>self</i>, <a href="qbrush.html">QBrush</a>&#160;<i>bg</i>)</h3><p>Sets the background brush of the painter to the given
<i>brush</i>.</p>
<p>The background brush is the brush that is filled in when drawing
opaque text, stippled lines and bitmaps. The background brush has
no effect in transparent background mode (which is the
default).</p>
<p><b>See also</b> <a href="qpainter.html#background">background</a>(), <a href="qpainter.html#setBackgroundMode">setBackgroundMode</a>(), and
<a href="qpainter.html#settings">Settings</a>.</p>


<h3 class="fn"><a name="setBackgroundMode" />QPainter.setBackgroundMode (<i>self</i>, <a href="qt.html#BGMode-enum">Qt.BGMode</a>&#160;<i>mode</i>)</h3><p>Sets the background mode of the painter to the given
<i>mode</i></p>
<p><a href="qt.html#BGMode-enum">Qt.TransparentMode</a> (the
default) draws stippled lines and text without setting the
background pixels. <a href="qt.html#BGMode-enum">Qt.OpaqueMode</a>
fills these space with the current background color.</p>
<p>Note that in order to draw a bitmap or pixmap transparently, you
must use <a href="qpixmap.html#setMask">QPixmap.setMask</a>().</p>
<p><b>See also</b> <a href="qpainter.html#backgroundMode">backgroundMode</a>(), <a href="qpainter.html#setBackground">setBackground</a>(), and <a href="qpainter.html#settings">Settings</a>.</p>


<h3 class="fn"><a name="setBrush" />QPainter.setBrush (<i>self</i>, <a href="qbrush.html">QBrush</a>&#160;<i>brush</i>)</h3><p>Sets the painter's brush to the given <i>brush</i>.</p>
<p>The painter's brush defines how shapes are filled.</p>
<p><b>See also</b> <a href="qpainter.html#brush">brush</a>() and
<a href="qpainter.html#settings">Settings</a>.</p>


<h3 class="fn"><a name="setBrush-2" />QPainter.setBrush (<i>self</i>, <a href="qt.html#BrushStyle-enum">Qt.BrushStyle</a>&#160;<i>style</i>)</h3><p>This is an overloaded function.</p>
<p>Sets the painter's brush to black color and the specified
<i>style</i>.</p>


<h3 class="fn"><a name="setBrushOrigin" />QPainter.setBrushOrigin (<i>self</i>, <a href="qpointf.html">QPointF</a>)</h3><p>Sets the brush origin to <i>position</i>.</p>
<p>The brush origin specifies the (0, 0) coordinate of the
painter's brush.</p>
<p>Note that while the <a href="qpainter.html#brushOrigin">brushOrigin</a>() was necessary to
adopt the parent's background for a widget in Qt 3, this is no
longer the case since the Qt 4 painter doesn't paint the background
unless you explicitly tell it to do so by setting the widget's
<a href="qwidget.html#autoFillBackground-prop">autoFillBackground</a>
property to true.</p>
<p><b>See also</b> <a href="qpainter.html#brushOrigin">brushOrigin</a>() and <a href="qpainter.html#settings">Settings</a>.</p>


<h3 class="fn"><a name="setBrushOrigin-2" />QPainter.setBrushOrigin (<i>self</i>, int&#160;<i>x</i>, int&#160;<i>y</i>)</h3><p>This is an overloaded function.</p>
<p>Sets the brush's origin to the given <i>position</i>.</p>


<h3 class="fn"><a name="setBrushOrigin-3" />QPainter.setBrushOrigin (<i>self</i>, <a href="qpoint.html">QPoint</a>&#160;<i>p</i>)</h3><p>This is an overloaded function.</p>
<p>Sets the brush's origin to point (<i>x</i>, <i>y</i>).</p>


<h3 class="fn"><a name="setClipPath" />QPainter.setClipPath (<i>self</i>, <a href="qpainterpath.html">QPainterPath</a>&#160;<i>path</i>, <a href="qt.html#ClipOperation-enum">Qt.ClipOperation</a>&#160;<i>operation</i>&#160;=&#160;Qt.ReplaceClip)</h3><p>Enables clipping, and sets the clip path for the painter to the
given <i>path</i>, with the clip <i>operation</i>.</p>
<p>Note that the clip path is specified in logical (painter)
coordinates.</p>
<p><b>See also</b> <a href="qpainter.html#clipPath">clipPath</a>(),
<a href="qpainter.html#clipRegion">clipRegion</a>(), and <a href="qpainter.html#clipping">Clipping</a>.</p>


<h3 class="fn"><a name="setClipping" />QPainter.setClipping (<i>self</i>, bool&#160;<i>enable</i>)</h3><p>Enables clipping if <i>enable</i> is true, or disables clipping
if <i>enable</i> is false.</p>
<p><b>See also</b> <a href="qpainter.html#hasClipping">hasClipping</a>() and <a href="qpainter.html#clipping">Clipping</a>.</p>


<h3 class="fn"><a name="setClipRect" />QPainter.setClipRect (<i>self</i>, <a href="qrectf.html">QRectF</a>&#160;<i>rectangle</i>, <a href="qt.html#ClipOperation-enum">Qt.ClipOperation</a>&#160;<i>operation</i>&#160;=&#160;Qt.ReplaceClip)</h3><p>Enables clipping, and sets the clip region to the given
<i>rectangle</i> using the given clip <i>operation</i>. The default
operation is to replace the current clip rectangle.</p>
<p>Note that the clip rectangle is specified in logical (painter)
coordinates.</p>
<p><b>See also</b> <a href="qpainter.html#clipRegion">clipRegion</a>(), <a href="qpainter.html#setClipping">setClipping</a>(), and <a href="qpainter.html#clipping">Clipping</a>.</p>


<h3 class="fn"><a name="setClipRect-2" />QPainter.setClipRect (<i>self</i>, int&#160;<i>x</i>, int&#160;<i>y</i>, int&#160;<i>width</i>, int&#160;<i>height</i>, <a href="qt.html#ClipOperation-enum">Qt.ClipOperation</a>&#160;<i>operation</i>&#160;=&#160;Qt.ReplaceClip)</h3><p>Enables clipping, and sets the clip region to the rectangle
beginning at (<i>x</i>, <i>y</i>) with the given <i>width</i> and
<i>height</i>.</p>


<h3 class="fn"><a name="setClipRect-3" />QPainter.setClipRect (<i>self</i>, <a href="qrect.html">QRect</a>&#160;<i>rectangle</i>, <a href="qt.html#ClipOperation-enum">Qt.ClipOperation</a>&#160;<i>operation</i>&#160;=&#160;Qt.ReplaceClip)</h3><p>This is an overloaded function.</p>
<p>Enables clipping, and sets the clip region to the given
<i>rectangle</i> using the given clip <i>operation</i>.</p>


<h3 class="fn"><a name="setClipRegion" />QPainter.setClipRegion (<i>self</i>, <a href="qregion.html">QRegion</a>&#160;<i>region</i>, <a href="qt.html#ClipOperation-enum">Qt.ClipOperation</a>&#160;<i>operation</i>&#160;=&#160;Qt.ReplaceClip)</h3><p>Sets the clip region to the given <i>region</i> using the
specified clip <i>operation</i>. The default clip operation is to
replace the current clip region.</p>
<p>Note that the clip region is given in logical coordinates.</p>
<p><b>See also</b> <a href="qpainter.html#clipRegion">clipRegion</a>(), <a href="qpainter.html#setClipRect">setClipRect</a>(), and <a href="qpainter.html#clipping">Clipping</a>.</p>


<h3 class="fn"><a name="setCompositionMode" />QPainter.setCompositionMode (<i>self</i>, <a href="qpainter.html#CompositionMode-enum">CompositionMode</a>&#160;<i>mode</i>)</h3><p>Sets the composition mode to the given <i>mode</i>.</p>
<p><b>Warning:</b> Only a <a href="qpainter.html">QPainter</a>
operating on a <a href="qimage.html">QImage</a> fully supports all
composition modes. The RasterOp modes are supported for X11 as
described in <a href="qpainter.html#compositionMode">compositionMode</a>().</p>
<p><b>See also</b> <a href="qpainter.html#compositionMode">compositionMode</a>().</p>


<h3 class="fn"><a name="setFont" />QPainter.setFont (<i>self</i>, <a href="qfont.html">QFont</a>&#160;<i>f</i>)</h3><p>Sets the painter's font to the given <i>font</i>.</p>
<p>This font is used by subsequent <a href="qpainter.html#drawText">drawText</a>() functions. The text color
is the same as the pen color.</p>
<p>If you set a font that isn't available, Qt finds a close match.
<a href="qpainter.html#font">font</a>() will return what you set
using setFont() and <a href="qpainter.html#fontInfo">fontInfo</a>()
returns the font actually being used (which may be the same).</p>
<p><b>See also</b> <a href="qpainter.html#font">font</a>(),
<a href="qpainter.html#drawText">drawText</a>(), and <a href="qpainter.html#settings">Settings</a>.</p>


<h3 class="fn"><a name="setLayoutDirection" />QPainter.setLayoutDirection (<i>self</i>, <a href="qt.html#LayoutDirection-enum">Qt.LayoutDirection</a>&#160;<i>direction</i>)</h3><p>Sets the layout direction used by the painter when drawing text,
to the specified <i>direction</i>.</p>
<p>The default is <a href="qt.html#LayoutDirection-enum">Qt.LayoutDirectionAuto</a>, which
will implicitly determine the direction from the text drawn.</p>
<p><b>See also</b> <a href="qtextoption.html#setTextDirection">QTextOption.setTextDirection</a>(),
<a href="qpainter.html#layoutDirection">layoutDirection</a>(),
<a href="qpainter.html#drawText">drawText</a>(), and <a href="qpainter.html#settings">Settings</a>.</p>


<h3 class="fn"><a name="setMatrix" />QPainter.setMatrix (<i>self</i>, <a href="qmatrix.html">QMatrix</a>&#160;<i>matrix</i>, bool&#160;<i>combine</i>&#160;=&#160;False)</h3><h3 class="fn"><a name="setMatrixEnabled" />QPainter.setMatrixEnabled (<i>self</i>, bool&#160;<i>enabled</i>)</h3><h3 class="fn"><a name="setOpacity" />QPainter.setOpacity (<i>self</i>, float&#160;<i>opacity</i>)</h3><p>Sets the opacity of the painter to <i>opacity</i>. The value
should be in the range 0.0 to 1.0, where 0.0 is fully transparent
and 1.0 is fully opaque.</p>
<p>Opacity set on the painter will apply to all drawing operations
individually.</p>
<p>This function was introduced in Qt 4.2.</p>
<p><b>See also</b> <a href="qpainter.html#opacity">opacity</a>().</p>


<h3 class="fn"><a name="setPen" />QPainter.setPen (<i>self</i>, <a href="qcolor.html">QColor</a>&#160;<i>color</i>)</h3><p>Sets the painter's pen to be the given <i>pen</i>.</p>
<p>The <i>pen</i> defines how to draw lines and outlines, and it
also defines the text color.</p>
<p><b>See also</b> <a href="qpainter.html#pen">pen</a>() and
<a href="qpainter.html#settings">Settings</a>.</p>


<h3 class="fn"><a name="setPen-2" />QPainter.setPen (<i>self</i>, <a href="qpen.html">QPen</a>&#160;<i>pen</i>)</h3><p>This is an overloaded function.</p>
<p>Sets the painter's pen to have style <a href="qt.html#PenStyle-enum">Qt.SolidLine</a>, width 0 and the
specified <i>color</i>.</p>


<h3 class="fn"><a name="setPen-3" />QPainter.setPen (<i>self</i>, <a href="qt.html#PenStyle-enum">Qt.PenStyle</a>&#160;<i>style</i>)</h3><p>This is an overloaded function.</p>
<p>Sets the painter's pen to have the given <i>style</i>, width 0
and black color.</p>


<h3 class="fn"><a name="setRedirected" />QPainter.setRedirected (<a href="qpaintdevice.html">QPaintDevice</a>&#160;<i>device</i>, <a href="qpaintdevice.html">QPaintDevice</a>&#160;<i>replacement</i>, <a href="qpoint.html">QPoint</a>&#160;<i>offset</i>&#160;=&#160;QPoint())</h3><h3 class="fn"><a name="setRenderHint" />QPainter.setRenderHint (<i>self</i>, <a href="qpainter.html#RenderHint-enum">RenderHint</a>&#160;<i>hint</i>, bool&#160;<i>on</i>&#160;=&#160;True)</h3><p>Sets the given render <i>hint</i> on the painter if <i>on</i> is
true; otherwise clears the render hint.</p>
<p><b>See also</b> <a href="qpainter.html#setRenderHints">setRenderHints</a>(), <a href="qpainter.html#renderHints">renderHints</a>(), and <a href="qpainter.html#rendering-quality">Rendering Quality</a>.</p>


<h3 class="fn"><a name="setRenderHints" />QPainter.setRenderHints (<i>self</i>, <a href="qpainter-renderhints.html">RenderHints</a>&#160;<i>hints</i>, bool&#160;<i>on</i>&#160;=&#160;True)</h3><p>Sets the given render <i>hints</i> on the painter if <i>on</i>
is true; otherwise clears the render hints.</p>
<p>This function was introduced in Qt 4.2.</p>
<p><b>See also</b> <a href="qpainter.html#setRenderHint">setRenderHint</a>(), <a href="qpainter.html#renderHints">renderHints</a>(), and <a href="qpainter.html#rendering-quality">Rendering Quality</a>.</p>


<h3 class="fn"><a name="setTransform" />QPainter.setTransform (<i>self</i>, <a href="qtransform.html">QTransform</a>&#160;<i>transform</i>, bool&#160;<i>combine</i>&#160;=&#160;False)</h3><p>Sets the world transformation matrix. If <i>combine</i> is true,
the specified <i>transform</i> is combined with the current matrix;
otherwise it replaces the current matrix.</p>
<p>This function was introduced in Qt 4.3.</p>
<p><b>See also</b> <a href="qpainter.html#transform">transform</a>() and <a href="qpainter.html#setWorldTransform">setWorldTransform</a>().</p>


<h3 class="fn"><a name="setViewport" />QPainter.setViewport (<i>self</i>, <a href="qrect.html">QRect</a>&#160;<i>viewport</i>)</h3><p>Sets the painter's viewport rectangle to the given
<i>rectangle</i>, and enables view transformations.</p>
<p>The viewport rectangle is part of the view transformation. The
viewport specifies the device coordinate system. Its sister, the
<a href="qpainter.html#window">window</a>(), specifies the logical
coordinate system.</p>
<p>The default viewport rectangle is the same as the device's
rectangle.</p>
<p><b>See also</b> <a href="qpainter.html#viewport">viewport</a>(),
<a href="qpainter.html#viewTransformEnabled">viewTransformEnabled</a>(),
and <a href="coordsys.html#window-viewport-conversion">Window-Viewport
Conversion</a>.</p>


<h3 class="fn"><a name="setViewport-2" />QPainter.setViewport (<i>self</i>, int&#160;<i>x</i>, int&#160;<i>y</i>, int&#160;<i>w</i>, int&#160;<i>h</i>)</h3><p>This is an overloaded function.</p>
<p>Sets the painter's viewport rectangle to be the rectangle
beginning at (<i>x</i>, <i>y</i>) with the given <i>width</i> and
<i>height</i>.</p>


<h3 class="fn"><a name="setViewTransformEnabled" />QPainter.setViewTransformEnabled (<i>self</i>, bool&#160;<i>enable</i>)</h3><p>Enables view transformations if <i>enable</i> is true, or
disables view transformations if <i>enable</i> is false.</p>
<p><b>See also</b> <a href="qpainter.html#viewTransformEnabled">viewTransformEnabled</a>() and
<a href="coordsys.html#window-viewport-conversion">Window-Viewport
Conversion</a>.</p>


<h3 class="fn"><a name="setWindow" />QPainter.setWindow (<i>self</i>, <a href="qrect.html">QRect</a>&#160;<i>window</i>)</h3><p>Sets the painter's window to the given <i>rectangle</i>, and
enables view transformations.</p>
<p>The window rectangle is part of the view transformation. The
window specifies the logical coordinate system. Its sister, the
<a href="qpainter.html#viewport">viewport</a>(), specifies the
device coordinate system.</p>
<p>The default window rectangle is the same as the device's
rectangle.</p>
<p><b>See also</b> <a href="qpainter.html#window">window</a>(),
<a href="qpainter.html#viewTransformEnabled">viewTransformEnabled</a>(),
and <a href="coordsys.html#window-viewport-conversion">Window-Viewport
Conversion</a>.</p>


<h3 class="fn"><a name="setWindow-2" />QPainter.setWindow (<i>self</i>, int&#160;<i>x</i>, int&#160;<i>y</i>, int&#160;<i>w</i>, int&#160;<i>h</i>)</h3><p>This is an overloaded function.</p>
<p>Sets the painter's window to the rectangle beginning at
(<i>x</i>, <i>y</i>) and the given <i>width</i> and
<i>height</i>.</p>


<h3 class="fn"><a name="setWorldMatrix" />QPainter.setWorldMatrix (<i>self</i>, <a href="qmatrix.html">QMatrix</a>&#160;<i>matrix</i>, bool&#160;<i>combine</i>&#160;=&#160;False)</h3><h3 class="fn"><a name="setWorldMatrixEnabled" />QPainter.setWorldMatrixEnabled (<i>self</i>, bool&#160;<i>enabled</i>)</h3><p>Enables transformations if <i>enable</i> is true, or disables
transformations if <i>enable</i> is false. The world transformation
matrix is not changed.</p>
<p>This function was introduced in Qt 4.2.</p>
<p><b>See also</b> <a href="qpainter.html#worldMatrixEnabled">worldMatrixEnabled</a>(),
<a href="qpainter.html#worldTransform">worldTransform</a>(), and
<a href="qpainter.html#coordinate-transformations">Coordinate
Transformations</a>.</p>


<h3 class="fn"><a name="setWorldTransform" />QPainter.setWorldTransform (<i>self</i>, <a href="qtransform.html">QTransform</a>&#160;<i>matrix</i>, bool&#160;<i>combine</i>&#160;=&#160;False)</h3><p>Sets the world transformation matrix. If <i>combine</i> is true,
the specified <i>matrix</i> is combined with the current matrix;
otherwise it replaces the current matrix.</p>
<p><b>See also</b> <a href="qpainter.html#worldTransform">worldTransform</a>(), <a href="qpainter.html#transform">transform</a>(), and <a href="qpainter.html#setTransform">setTransform</a>().</p>


<h3 class="fn"><a name="shear" />QPainter.shear (<i>self</i>, float&#160;<i>sh</i>, float&#160;<i>sv</i>)</h3><p>Shears the coordinate system by (<i>sh</i>, <i>sv</i>).</p>
<p><b>See also</b> <a href="qpainter.html#setWorldTransform">setWorldTransform</a>() and
<a href="qpainter.html#coordinate-transformations">Coordinate
Transformations</a>.</p>


<h3 class="fn"><a name="strokePath" />QPainter.strokePath (<i>self</i>, <a href="qpainterpath.html">QPainterPath</a>&#160;<i>path</i>, <a href="qpen.html">QPen</a>&#160;<i>pen</i>)</h3><p>Draws the outline (strokes) the path <i>path</i> with the pen
specified by <i>pen</i></p>
<p><b>See also</b> <a href="qpainter.html#fillPath">fillPath</a>()
and <a href="qpainter.html#drawing">Drawing</a>.</p>


<h3 class="fn"><a name="testRenderHint" />bool QPainter.testRenderHint (<i>self</i>, <a href="qpainter.html#RenderHint-enum">RenderHint</a>&#160;<i>hint</i>)</h3><p>Returns true if <i>hint</i> is set; otherwise returns false.</p>
<p>This function was introduced in Qt 4.3.</p>
<p><b>See also</b> <a href="qpainter.html#renderHints">renderHints</a>() and <a href="qpainter.html#setRenderHint">setRenderHint</a>().</p>


<h3 class="fn"><a name="transform" /><a href="qtransform.html">QTransform</a> QPainter.transform (<i>self</i>)</h3><p>Returns the world transformation matrix.</p>
<p><b>See also</b> <a href="qpainter.html#setTransform">setTransform</a>() and <a href="qpainter.html#worldTransform">worldTransform</a>().</p>


<h3 class="fn"><a name="translate" />QPainter.translate (<i>self</i>, <a href="qpointf.html">QPointF</a>&#160;<i>offset</i>)</h3><p>Translates the coordinate system by the given <i>offset</i>;
i.e. the given <i>offset</i> is added to points.</p>
<p><b>See also</b> <a href="qpainter.html#setWorldTransform">setWorldTransform</a>() and
<a href="qpainter.html#coordinate-transformations">Coordinate
Transformations</a>.</p>


<h3 class="fn"><a name="translate-2" />QPainter.translate (<i>self</i>, float&#160;<i>dx</i>, float&#160;<i>dy</i>)</h3><p>This is an overloaded function.</p>
<p>Translates the coordinate system by the given <i>offset</i>.</p>


<h3 class="fn"><a name="translate-3" />QPainter.translate (<i>self</i>, <a href="qpoint.html">QPoint</a>&#160;<i>offset</i>)</h3><p>This is an overloaded function.</p>
<p>Translates the coordinate system by the vector (<i>dx</i>,
<i>dy</i>).</p>


<h3 class="fn"><a name="viewport" /><a href="qrect.html">QRect</a> QPainter.viewport (<i>self</i>)</h3><p>Returns the viewport rectangle.</p>
<p><b>See also</b> <a href="qpainter.html#setViewport">setViewport</a>() and <a href="qpainter.html#setViewTransformEnabled">setViewTransformEnabled</a>().</p>


<h3 class="fn"><a name="viewTransformEnabled" />bool QPainter.viewTransformEnabled (<i>self</i>)</h3><p>Returns true if view transformation is enabled; otherwise
returns false.</p>
<p><b>See also</b> <a href="qpainter.html#setViewTransformEnabled">setViewTransformEnabled</a>()
and <a href="qpainter.html#worldTransform">worldTransform</a>().</p>


<h3 class="fn"><a name="window" /><a href="qrect.html">QRect</a> QPainter.window (<i>self</i>)</h3><p>Returns the window rectangle.</p>
<p><b>See also</b> <a href="qpainter.html#setWindow">setWindow</a>() and <a href="qpainter.html#setViewTransformEnabled">setViewTransformEnabled</a>().</p>


<h3 class="fn"><a name="worldMatrix" /><a href="qmatrix.html">QMatrix</a> QPainter.worldMatrix (<i>self</i>)</h3><h3 class="fn"><a name="worldMatrixEnabled" />bool QPainter.worldMatrixEnabled (<i>self</i>)</h3><p>Returns true if world transformation is enabled; otherwise
returns false.</p>
<p>This function was introduced in Qt 4.2.</p>
<p><b>See also</b> <a href="qpainter.html#setWorldMatrixEnabled">setWorldMatrixEnabled</a>(),
<a href="qpainter.html#worldTransform">worldTransform</a>(), and
<a href="coordsys.html">Coordinate System</a>.</p>


<h3 class="fn"><a name="worldTransform" /><a href="qtransform.html">QTransform</a> QPainter.worldTransform (<i>self</i>)</h3><p>Returns the world transformation matrix.</p>
<p><b>See also</b> <a href="qpainter.html#setWorldTransform">setWorldTransform</a>().</p>
<h3 class="fn"><a name="__enter__" />object QPainter.__enter__ (<i>self</i>)</h3><h3 class="fn"><a name="__exit__" />QPainter.__exit__ (<i>self</i>, object&#160;<i>type</i>, object&#160;<i>value</i>, object&#160;<i>traceback</i>)</h3><address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt&#160;4.9.1 for X11</td><td align="center" width="50%">Copyright &#169; <a href="http://www.riverbankcomputing.com">Riverbank&#160;Computing&#160;Ltd</a> and <a href="http://www.qtsoftware.com">Nokia</a> 2011</td><td align="right" width="25%">Qt&#160;4.8.0</td></tr></table></div></address></body></html>